Write Vital on Smart on FHIR

490 views Asked by At

I am looking for curl request example to write Vitals on Smart on FHIR (hir-open-api-dstu2.smarthealthit.org) database.

Here is what I have found on http://docs.smarthealthit.org/tutorials/server-quick-start/

Example of Read Patient Demographics:

curl 'https://fhir-open-api-dstu2.smarthealthit.org/Patient/1482713' -H 'Accept: application/json'

Example to retrieve Vitals:

curl 'https://fhir-open-api-dstu2.smarthealthit.org/Observation?subject%3APatient=1482713&code=3141-9%2C8302-2%2C8287-5%2C39156-5&_count=50' -H 'Accept: application/json'

PatientID=1482713 and LOINC Codes: 3141-9, 8302-2, 8287-5, 39156-5 (Vitals)

How to write - it is certainly possible as outlined here:

https://fhirblog.com/2015/03/06/smart-writing/

https://fhirblog.com/2016/03/23/smart-scopes-and-profiles/

A curl request to write vitals would look like this (an example which does not work):

curl 'https://fhir-open-api-dstu2.smarthealthit.org/Observation.write?subject%3APatient=1482713&code=3141-9=10&_count=50' -H 'Accept: application/json'

Thanks for your help!

2

There are 2 answers

1
Josh On BEST ANSWER

To write, you'll want to use:

curl \
  -X POST \
  https://fhir-open-api-dstu2.smarthealthit.org/Observation \
  -H 'Content-type: application/json+fhir' \
  -H 'Accept: application/json+fhir' \
  --data '{"resourceType": "Observation"}'

And of course, you should provide more details about your observation in the data payload :-)

0
SC-SL On

This is based on Josh M's reply:

 curl   -X POST  \
  https://fhir-open-api-dstu2.smarthealthit.org/Observation \
  -H 'Content-type: application/json+fhir'  \
  -H 'Accept: application/json+fhir' \
  --data @payload.json 

A more defined payload file with effective date, blood pressure and its two components: --payload.json file ---

 {
  "resourceType": "Observation",
  "status": "final",
  "subject": {
    "reference": "Patient/1951076"
  },
  "category": {
    "coding": [
      {
        "system": "http://hl7.org/fhir/observation-category",
        "code": "vital-signs",
        "display": "Vital Signs"
      }
    ],
    "text": "Vital Signs"
  },
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "55284-4",
        "display": "SBlood pressure systolic and diastolic"
      }
    ],
    "text": "Blood pressure systolic and diastolic"
  },
        "encounter": {
          "reference": "Encounter/787"
        },
        "effectiveDateTime": "2016-08-17",
        "component": [
          {
                "code": {
                  "coding": [
                        {
                          "system": "http://loinc.org",
                          "code": "8480-6",
                          "display": "Systolic blood pressure"
                        }
                  ],
                  "text": "Systolic blood pressure"
                },
                "valueQuantity": {
                  "value": 125,
                  "unit": "mmHg",
                  "system": "http://unitsofmeasure.org",
                  "code": "mm[Hg]"
                }
          },
          {
                "code": {
                  "coding": [
                        {
                          "system": "http://loinc.org",
                          "code": "8462-4",
                          "display": "Diastolic blood pressure"
                        }
                  ],
                  "text": "Diastolic blood pressure"
                },
                "valueQuantity": {
                  "value": 75,
                  "unit": "mmHg",
                  "system": "http://unitsofmeasure.org",
                  "code": "mm[Hg]"
                }
          }
        ]
}