ABE Automation Azure serverless python function
- When submission is in
Submitted
status- If record is found in
IDADATA
- If there is existing classification in
IDADATA
- Update submission to
Existing classification
status
- Update submission to
- Else
- Update
SPOT_CHECK_PERCENT
of submission toSpot check
status - Otherwise if submission has
IDA_CATEGORY_ID_LOOKUP_id
- Update submission to
Recorded
- Update submission to
- Update
- If there is existing classification in
- If record is found in
- When submission is in
Recorded
status- If record is found in
IDADATA
- If record has have
IDA_CATEGORY_ID
- If record
IDA_CATEGORY_ID
does not match submissionIDA_CATEGORY_ID_LOOKUP_id
- Update submission to
Existing classification
status
- Update submission to
- If record
- Else
- Update
IDA_CATEGORY_ID
,LAST_MODIFIED_BY
,LAST_MODIFIED_DATE
inIDADATA
for record - Generate a new
IDA_APP_NUM
if it does not have one.
- Update
- If record has have
- If record is found in
Automation webhook
Endpoint for concatenating address fields and keeping the FULL_ADDRESS column up to date. See ADDRESS_POST in tests/mocks.py for example of parameters that the api handles.
Endpoint for concatenating block and lot fields and keeping the BLOCKLOT column up to date. See BLOCKLOT_POST in tests/mocks.py for example of parameters to send the api.
Query http status of the serverless function.
Example
$ curl https://<host>/api/status/http
{"status": "success", "data": {"message": "200 OK"}}
DO NOT USE "SWAP" option until issue is resolved.
see more at: Azure/azure-functions-host#7336
Install Pipenv (if needed)
$ pip install --user pipenv
Install included packages
$ pipenv install
Output virtualenv information
$ pipenv --venv
Create a function in Azure with Python using Visual Studio Code
Create a Python function in Azure from the command line
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
.
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
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
Code coverage command with missing statement line numbers
$ pipenv run python -m pytest -s --cov --cov-report term-missing
Set up git hook scripts with pre-commit
$ pipenv run pre-commit install
- Setup
.env
- Setup environmental variables from
local.settings.json
- Setup environmental variables from
- Setup coveralls.
- Log into coveralls.io to obtain the coverall token for your repo.
- Create an environment variable in CircleCI with the name
COVERALLS_REPO_TOKEN
and the coverall token value.
reference: How to fork your own repo in Github
First, create a new blank repo that you want to ultimately be a fork of your existing repo. We will call this new repo "my-awesome-microservice-py".
Next, make a clone of that new blank repo on your machine:
$ git clone https://github.com/SFDigitalServices/my-awesome-microservice-fn-py.git
While this technically isn’t forking, its basically the same thing. What you want to do is add a remote upstream to this new empty repo that points to your original repo you want to fork:
$ git remote add upstream https://github.com/SFDigitalServices/microservice-fn-py.git
The last step is to pull down a complete copy of the original repo:
$ git fetch upstream
$ git merge upstream/main
Or, an easier way:
$ git pull upstream main
Now, you can work on your new repo to your hearts content. If any changes are made to the original repo, simply execute a git pull upstream main
and your new repo will receive the updates that were made to the original!
Psst: Don't forget to upload the fresh copy of your new repo back up to git:
$ git push origin main