Releasesv0.1.0
Api referenceEndpointsFhir

The user's records as FHIR R4 Observations

GET
/v1/users/{id}/fhir/Observation

The user's records as one FHIR R4 (4.0.1) searchset Bundle of Observations, Content-Type: application/fhir+json: quantity samples (qs- ids), blood pressure panels pairing a systolic and a diastolic sample (bp-), sleep sessions (sleep-), workouts (workout-) and daily summaries (daily-), merged in time order (a sample's start, a bedtime, a workout's start, a day at midnight UTC), then by kind and id. Paged like every list: the Bundle's next link carries the cursor, and there is no next link on the last page; total is left out. A blood pressure pair is never split across pages, and its two samples are not listed on their own. Vital signs meet the R4 vital signs profiles they claim in meta.profile. The mapping (codes, units, categories, provenance and limits) is in docs/fhir.md. In the merged view (the default) a record another source covers better is left out, and a daily summary keeps only the figures it owns (see view). The filters below combine: a record is listed when it matches all of them. Errors are application/problem+json like the rest of the API.

Authorization

tenantKey
headerAuthorizationBearer <token>

Tenant API key, ohs_sk_ + 43 base62 characters.

Path Parameters

id*string
Formatuuid

Query Parameters

type?string

Canonical quantity type, for example heart_rate: only quantity samples of that type, and the blood pressure panels holding a sample of it. Optional; a name outside the quantity type catalog is a 400 (unless this user has samples of it).

code?string

A FHIR token system|code matched against Observation.code: a LOINC code (http://loinc.org|8867-4; 85354-9, 8480-6 and 8462-4 find the blood pressure panels, 93832-4 the sleep sessions, 55411-3 the workouts), a quantity type (https://github.com/soma-intelligence/open-health-sync/fhir/CodeSystem/quantity-type|heart_rate, like type), or a record type (https://github.com/soma-intelligence/open-health-sync/fhir/CodeSystem/record-type| blood_pressure, sleep_session, workout or daily_summary). One value; other systems are a 400. A code no Observation carries is an empty Bundle.

category?string

An HL7 observation category code, bare or as http://terminology.hl7.org/CodeSystem/observation-category|code: vital-signs, laboratory or activity (activity samples, workouts and daily summaries). One value. Another code of that system is an empty Bundle; anything else is a 400.

start?|

Inclusive lower bound, RFC 3339 or YYYY-MM-DD.

end?|

Exclusive upper bound, RFC 3339 or YYYY-MM-DD. Must not be before start.

view?string

merged (the default): when several sources recorded the same thing (a ring and a watch the same night, a phone and a watch the same steps, one sample directly and through an aggregator), only the best ranked source's record is listed, so nothing counts twice. The order of sources is the user's (see source-priorities). all: every stored record of every source.

Default"merged"
Value in"merged""all"
cursor?string

The next_cursor of the previous page.

limit?integer
Range1 <= value <= 1000
Default100

Header Parameters

Authorization*string

The tenant API key, as a bearer secret.

Response Body

One page, by effective start time.

application/fhir+json
  1. response

A FHIR R4 searchset Bundle of Observations.

resourceType*string
type*string
link*array<>
entry?array<>

Absent on an empty page (FHIR JSON has no empty arrays).

curl -X GET 'http://localhost:8080/v1/users/497f6eca-6276-4993-bfeb-53cbbbba6f08/fhir/Observation' \  -H 'Authorization: Bearer ohs_sk_...'
{  "resourceType": "Bundle",  "type": "searchset",  "link": [    {      "relation": "self",      "url": "http://example.com"    }  ],  "entry": [    {      "fullUrl": "http://example.com",      "resource": {        "resourceType": "Observation",        "id": "qs-1234",        "meta": {          "source": "http://example.com",          "profile": [            "http://example.com"          ],          "tag": [            {              "system": "http://example.com",              "code": "string",              "display": "string"            }          ]        },        "identifier": [          {            "system": "http://example.com",            "value": "string"          }        ],        "status": "final",        "category": [          {            "coding": [              {                "system": "http://example.com",                "code": "string",                "display": "string"              }            ],            "text": "string"          }        ],        "code": {          "coding": [            {              "system": "http://example.com",              "code": "string",              "display": "string"            }          ],          "text": "string"        },        "subject": {          "reference": "Patient/3f0c2f8e-8b8a-4c55-9f5e-2b0f3a1d9c11",          "identifier": {            "system": "http://example.com",            "value": "string"          },          "display": "string"        },        "effectiveDateTime": "2019-08-24T14:15:22Z",        "effectivePeriod": {          "start": "2019-08-24T14:15:22Z",          "end": "2019-08-24T14:15:22Z"        },        "issued": "2019-08-24T14:15:22Z",        "valueQuantity": {          "value": 0,          "unit": "string",          "system": "http://unitsofmeasure.org",          "code": "/min"        },        "valueCodeableConcept": {          "coding": [            {              "system": "http://example.com",              "code": "string",              "display": "string"            }          ],          "text": "string"        },        "dataAbsentReason": {          "coding": [            {              "system": "http://example.com",              "code": "string",              "display": "string"            }          ],          "text": "string"        },        "device": {          "reference": "Patient/3f0c2f8e-8b8a-4c55-9f5e-2b0f3a1d9c11",          "identifier": {            "system": "http://example.com",            "value": "string"          },          "display": "string"        },        "component": [          {            "code": {              "coding": [                {                  "system": "http://example.com",                  "code": "string",                  "display": "string"                }              ],              "text": "string"            },            "valueQuantity": {              "value": 0,              "unit": "string",              "system": "http://unitsofmeasure.org",              "code": "/min"            },            "valueCodeableConcept": {              "coding": [                {                  "system": "http://example.com",                  "code": "string",                  "display": "string"                }              ],              "text": "string"            },            "dataAbsentReason": {              "coding": [                {                  "system": "http://example.com",                  "code": "string",                  "display": "string"                }              ],              "text": "string"            }          }        ]      },      "search": {        "mode": "match"      }    }  ]}
Edit on GitHub