Search code examples
hl7-fhir

Write Vital on Smart on FHIR


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!


Solution

  • 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 :-)