Skip to content

SFDigitalServices/address-microservice-fn-py

Repository files navigation

address-microservice-fn-js CircleCI Coverage Status

This microservice to transform address data for form.io components with URL Data Source

Enterprise Address System (EAS)

api/eas/lookup

Query EAS for list of addresses via partial address string. Example to be used for autocomplete.

Query string parameters

  • search search query to perform address lookup

  • additional query parameters supported by Socrata API

api/eas/json

Query and filter EAS data in JSON

Example filter by address

$ curl https://<host>/api/eas/json?address=200%20MAIN%20ST

Example filter by address, block, and lot

$ curl https://<host>/api/eas/json?address=200%20MAIN%20ST&block=3739&lot=008

Example query address_number, address_number_suffix, street_name, street_type, and unit_number with address, block, and lot

$ curl https://<host>/api/eas/json?$select=address,address_number,address_number_suffix,street_name,street_type,unit_number,block,lot,parcel_number&$where=address=%2777%20VAN%20NESS%20AVE%20%23100%27%20AND%20block%20=%270834%27%20AND%20lot=%27144%27

Accessible Business Entrance (ABE)

api/abe/lookup

Query ABE for list of addresses via partial address string. Example to be used for autocomplete.

Query string parameters

  • search search query to perform address lookup

  • additional query parameters supported by Socrata API

api/abe/json

Query and filter ABE data in JSON

Example filter by block, and lot

$ curl https://<host>/api/abe/json?block=3506&lot=001

Example query property_street_number, property_street_number_sfx, property_street_name, property_street_sfx, and property_unit with block, and lot

$ curl https://<host>/api/abe/json?$select=property_street_number,property_street_number_sfx,property_street_name,property_street_sfx,property_unit,block,lot&$where=block%20=%270834%27%20AND%20lot=%27144%27

Deployment notes

⚠️ [Linux Consumption] Successful slot swaps automatically reverted after a few minutes ⚠️

DO NOT USE "SWAP" option until issue is resolved.
see more at: Azure/azure-functions-host#7336

Development

Quickstart Guide

Create a function in Azure with Python using Visual Studio Code Create a Python function in Azure from the command line

Environment variables

Documentation In Functions, application settings, such as service connection strings, are exposed as environment variables during execution. You can access these settings by declaring import os and then using, setting = os.environ["setting-name"]. See example of local.settings.json file at local.settings.example.json.

Generating requirements.txt

Currently Azure Python Functions does not support pipenv. However we can run pipenv lock --requirements to produce a requirements file for the non-dev requirements and pipenv lock --requirements --dev to produce one for just the dev requirements. sample usage:
production

$ pipenv lock --requirements > requirements.txt

development

pipenv lock --requirements --dev > requirements-dev.txt

azure-functions-worker

DO NOT include azure-functions-worker in requirements.txt The Python Worker is managed by Azure Functions platform Manually managing azure-functions-worker may cause unexpected issues

Testing and Code Coverage

Code coverage command with missing statement line numbers

$ pipenv run python -m pytest --cov --cov-report term-missing

Prec-commit

Set up git hook scripts with pre-commit

$ pipenv run pre-commit install

Continuous integration

  • Setup .env
    1. Setup environmental variables from local.settings.json
  • Setup coveralls.
    1. Log into coveralls.io to obtain the coverall token for your repo.
    2. Create an environment variable in CircleCI with the name COVERALLS_REPO_TOKEN and the coverall token value.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published