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
# Family with income slightly above the federal poverty level
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/family_slightly_above_100_fpl_il.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 prototype API is hosted on cloud.gov at https://prototype-openfisca-usa-headstart.app.cloud.gov/.
If you want to test out the API without serving it locally, feel free to send JSON requests to the prototype. Because this is an early-stage prototype, there is no guarantee it will be available. There is also no guarantee that the deployed API 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
# 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 \
https://prototype-openfisca-usa-headstart.app.cloud.gov/calculate | \
jq
# Family with income slightly above the federal poverty level
curl -X POST -H "Content-Type: application/json" \
-d @./prototype_usa_head_start/situation_examples/family_slightly_above_100_fpl_il.json https://prototype-openfisca-usa-headstart.app.cloud.gov/calculate | \
jq