Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

18F/prototype-openfisca-usa-headstart

Prototype: OpenFisca Web API for USA Head Start Program

This is a sketchpad prototyping repo being used by 18F's Eligibility APIs Initiative to explore the OpenFisca platform.

⚠️ None of the eligibility rules expressed in this repository should be considered official interpretations of Head Start rules or policy. This is a sketchpad prototyping repo only. ⚠️

The code in this repo is based on the OpenFicsa Country Template.

Local installation

make install

Run tests

make test

Serve Web API locally

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

Rebuild

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

Deploy

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.

API on Cloud.gov

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

About

A sketchpad prototyping repo to explore the OpenFisca platform

Resources

License

AGPL-3.0, Unknown licenses found

Licenses found

AGPL-3.0
LICENSE
Unknown
LICENSE-ADDITIONAL-TERMS

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages