WIP - refactor of the Benefits Screening API and rules code in Python
-
Install uv package manager:
curl -LsSf https://astral.sh/uv/install.sh | shNote: Can also install it with pip:
pip install uv -
Install dependencies and create virtual environment:
uv sync
-
Activate the virtual environment:
source .venv/bin/activate -
Run the application:
uv run python src/main.py
Run tests using uv with PyTest:
uv run pytest tests/Automated deployment via branch merges:
- Staging: Merge to
stg→ deploys to staging Lambda - Production: Merge to
prod→ deploys to production Lambda
Workflow: Feature branch → PR → stg → test → prod
⚠️ Always test in staging before production deployment
- Create a new file under
program_rulestitled as the program code, and modify the program and description to match the new rule. I recommend just duplicating an existing file and renaming it. - Write the rule logic
evaluatemethod. This method will take in anAggregateEligibilityRequestunder therequestparameter, use this to write the rule logic. Feel free to create helper functions within the class to compute values, butevaluatemust return true or false - Your new rule will be auto-registered under the registry system, allowing it to be iterated through when checking all rules. It will also be auto-registered in the unit test, make sure to update the data for expected values on different test requests.
- Thoroughly test the program rules with different JSONs and expected values