This is a sketchpad prototyping repo being used by 18F's Eligibility APIs Initiative to explore the OpenFisca platform.
The code in this repo is based on the OpenFicsa Country Template.
make install
make test
To serve the Web API locally, run:
make serve-local
You can make sure that your instance of the API is working by requesting:
curl "http://localhost:5000/spec"
This endpoint returns the Open API specification of your API.
Test sample POST requests to the server:
# Family that appears eligible
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/family.json http://localhost:5000/calculate
# Family that appears ineligible
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/appears_ineligible_family.json http://localhost:5000/calculate
# Family that is eligible for multiple reasons
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/family_eligible_multiple_reasons.json http://localhost:5000/calculate
# Family with a child who has a disability
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/disability.json http://localhost:5000/calculate
Or, for a prettier JSON response, use jq:
# Family with a child who has a disability
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/disability.json http://localhost:5000/calculate \
| jq
Some changes to the code — for example, adding a new input variable — require re-building the project before they become available to you locally. Run:
make build
This app has been configured to deploy to cloud.gov with a manifest.yml
file.
See cloud.gov's "Your first deploy" guide for deployment instructions.
Our sandbox prototype app is hosted on cloud.gov at https://prototype-openfisca-usa-headstart.app.cloud.gov/. This app is not reliable or stable, since sandbox deployments are cleared by cloud.gov every 90 days.
If you want to test out the API without serving it locally, feel free to send JSON requests to the sandbox prototype —- just be aware there is no guarantee that the sandbox prototype will be available. There is also no guarantee that the deployed prototype will match the latest API code in this repo, since continuous deployment is not yet set up.
# Family that appears eligible
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/family.json \
https://prototype-openfisca-usa-headstart.app.cloud.gov/calculate | jq
# Family that appears ineligible
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/appears_ineligible_family.json \
https://prototype-openfisca-usa-headstart.app.cloud.gov/calculate | jq