State context
GET
https://api.ai4mproject.com/v1/context/statesScope: risk_scoresReturns what surrounds a risk score: how many people live in each state, and how well it is covered by bed nets, treatment and health facilities. Use it with the risk score to decide where need is greatest.
Parameters
Section titled “Parameters”None.
Request
Section titled “Request”curl "https://api.ai4mproject.com/v1/context/states" \ -H "Authorization: Bearer $AI4M_API_KEY"for state in client.get_state_context(): print(state.state, state.population, state.itn_use, state.travel_minutes_to_care)const report = await client.getStateContext();for (const state of report.states) { console.log(state.state, state.population, state.itn_use, state.travel_minutes_to_care);}states, err := client.StateContext(ctx)if err != nil { log.Fatal(err)}for _, state := range states { fmt.Println(state.State, state.Population)}Response
Section titled “Response”Shares run from 0 to 1. A figure is null where the source has no estimate for the area.
| Field | Type | Description |
|---|---|---|
source.name |
string | Where the coverage figures come from |
source.coverage_year |
integer | The year the net and treatment figures describe |
states[].state_code |
string | Two-letter state code |
states[].state |
string | State name |
states[].zone |
string | Geopolitical zone |
states[].lgas |
integer | Number of LGAs in the state |
states[].population |
integer | People living in the area |
states[].area_km2 |
number | Land area in square kilometres |
states[].itn_use |
number | Share of people who slept under a treated net |
states[].itn_access |
number | Share of people with access to a treated net |
states[].irs_coverage |
number | Share of people protected by indoor spraying |
states[].effective_treatment |
number | Share of malaria cases that get an effective treatment |
states[].travel_minutes_to_care |
number | Average travel time to the nearest health facility, in minutes |
states[].response_index |
number | Average of net use and effective treatment |
{ "source": { "name": "Malaria Atlas Project", "coverage_year": 2024, "note": "Modelled estimates shown as context. They are not inputs to the risk score. Shares run from 0 to 1." }, "states": [ { "state_code": "KN", "state": "Kano", "zone": "North West", "lgas": 44, "population": 14310694, "area_km2": 20072, "itn_use": 0.497, "itn_access": 0.542, "irs_coverage": 0, "effective_treatment": 0.574, "travel_minutes_to_care": 5.145, "response_index": 0.535 }, { "state_code": "LA", "state": "Lagos", "zone": "South West", "lgas": 20, "population": 12782537, "area_km2": 3783.6, "itn_use": 0.162, "itn_access": 0.285, "irs_coverage": 0, "effective_treatment": 0.574, "travel_minutes_to_care": 3.395, "response_index": 0.368 } ]}The example shows two of the 37 states. A state’s figures are averages across its LGAs, weighted by population.
Errors
Section titled “Errors”| Code | Status | When |
|---|---|---|
SCOPE_REQUIRED |
403 | The key does not include the scope this endpoint needs |
Any request can also return 401 for a bad key and 429 when a limit is reached. See Errors.