arieldiamond / trans-passports-api

An app that smoothes the path to getting a correctly-gendered passport for transgender Americans.
1 stars 1 forks source link

Create API for accessing flowchart data #8

Open approximatelylinear opened 7 years ago

approximatelylinear commented 7 years ago

Situation

The front-end will communicate with the data via a JSON API.

Target

Represent the possible paths through the app via a state machine. A path through the app proceeds from state to state until the end is reached. What are these states? Each state is just a collection of data:

State description

Field Description
Display Title The title we show to the user on screen when they reach this state
Display Text Whatever we should show on screen when a user is at this state
Next states A list of the next states the user could go to, with information about how to display them
External resources Links and so forth a user could visit that take them away from the app

At each step, the front end has access to all the information necessary to represent the current state, including it's text and it's possible subsequent states. When selects one of these subsequent states, the front end makes a call to the api to get information about it.

Proposal

We should create an API with a method get_state\<id>, where <id> refers to the id of a state. The API will then return all information related to that state.

Implementation details

We have to decide a few things...

What is the structure of the api response? (It should probably have the above fields, but we need to decide on an explicit structure.)

How can we convert the raw data (from the Talk Show Export Hack sheet in the Google doc into a coherent API response?)