OCHA Integration - Research Summary
This is a detailed summary of initial research on how to integrate the systems. See child pages for documentation of actual implementation.
OCHA API's information
Documentation
Detailed documentation is available here: api.hpc.tools/docs/v1/
This documentation is intended for users of the HPC Service public API, which provides data in JSON or XML formats.
For the API v2 endpoints (currently only data for Chad 2018 is available).
Old OPS API does not provide any documentation.
Authorization
Access to API is public, however there is limit to 1 request per second. Logged users does not have this limitation. API is using HTTP Basic Authentication.
GET /v1/public/fts/flow?year=2016 HTTP/1.1
Host: api.hpc.tools
Content-Type: application/json
Authorization: Basic base64(clientABC:passwordXYZ)
External ID
Synced models should be updated with additional fields, to document their origin. This is achieved using a dedicated base model class.
Column
Type
external_id
integer
external_source
choice - HPC or OPS
All further mappings includes those fields by default.
Response Plan API
List of available Response Plans
Endpoint get a list of current Response Plans in given country:
https://api.hpc.tools/v1/public/plan/country/<COUNTRY_ISO>
Example: https://api.hpc.tools/v1/public/plan/country/UKR
Field mapping
PRP Response Plan
HPC Plan
title
name
workspace
emergencies[0] if present else use locations[0]
start
startDate
end
endDate
plan_type
categories -> name
Sample JSON outputs
OCHA provided sample JSON outputs for some plans:
https://www.dropbox.com/sh/ogk4lrg4qyieyj7/AADlWxjBLyZHF5aszeCUrlwpa?dl=0
Response Plan Details
To get details of response plan, another endpoint is required:
https://api.hpc.tools/v1/public/rpm/plan/id/<plan_id>
Example: https://api.hpc.tools/v1/public/rpm/plan/id/514
Same endpoints returns different values depends on content parameter:
In summary - to get plan structure with monitoringPeriods, entities, attachments and measurements, endpoint looks like: https://api.hpc.tools/v1/public/rpm/plan/id/514?format=json&content=measurements
Clusters
There is a global cluster list, but then plans/responses can have their own cluster names sometimes as well.
However same Cluster name contains different ID's for different plans, example:
https://api.hpc.tools/v1/public/rpm/plan/id/641?format=json&content=entities
{
"id": 4042,
"name": "Education",
"customReference": "L5411",
"value": {
"description": null,
"icon": null,
"categories": []
},
"planId": 641,
"entityPrototype": {
"id": 2213,
"refCode": "CL",
"type": "GVE",
"value": {
"name": {
"en": {
"singular": "Cluster",
"plural": "Clusters"
}
},
"possibleChildren": [
{
"refCode": "CO",
"cardinality": "0-N",
"id": 2215
},
{
"refCode": "CA",
"cardinality": "0-N",
"id": 2216
}
]
}
},
"attachments": [],
"clusterNumber": "L5411"
}
https://api.hpc.tools/v1/public/rpm/plan/id/475?format=json&content=entities
{
"id": 1956,
"name": "Education",
"customReference": "1956",
"value": {
"description": null,
"icon": null,
"categories": []
},
"planId": 475,
"entityPrototype": {
"id": 2021,
"refCode": "CL",
"type": "GVE",
"value": {
"name": {
"en": {
"singular": "Cluster",
"plural": "Clusters"
}
},
"possibleChildren": [
{
"refCode": "CO",
"cardinality": "0-N",
"id": 2023
},
{
"refCode": "CA",
"cardinality": "0-N",
"id": 2024
}
]
}
},
"attachments": [],
"clusterNumber": "1956"
},
Endpoint for access global Clusters list:
https://api.hpc.tools/v1/public/global-cluster
Field mapping
https://api.hpc.tools/v1/public/rpm/plan/id/{id}?content=entities
PRP Cluster model fields
RPM Plan API fields
type
governingEntities -> name
(1)
response_plan
id
Cluster activity
To retrieve cluster activities it has to be used content=entities parameter:
https://api.hpc.tools/v1/public/rpm/plan/id/<plan_id>?content=entities
Field mapping
PRP Cluster Activity model fields
RPM Plan API fields
title
planEntities -> value -> description
(1)
cluster_objective
support
(2)
locations
attachments
(3)
reportables
attachments
(4)
Cluster objectives
To retrieve cluster objectives it has to be used content=entities parameter:
https://api.hpc.tools/v1/public/rpm/plan/id/<plan_id>?content=entities
Field mapping
PRP Cluster Objective model fields
RPM Plan API fields
title
planEntities -> value -> description
(1)
cluster
parent -> parentId
(2)
locations
attachments
(3)
reportables
attachments
(4)
Indicators and Disaggregation data
To retrieve disaggregation data it has to be used content=measurements parameter:
https://api.hpc.tools/v1/public/rpm/plan/id/<plan_id>?content=measurements
Field mapping
PRP Reportable model fields
RPM Plan API fields