Inserting multiple observation values in single resource - FHIR - hl7-fhir

I have hourly information for the patients heart rate like this
PID Hour HR
1 1 97
1 2 89
1 3 90
1 4 100
.....
.....
1 100 93
for each hour data i created json like this
# For Hour 1
{
"resourceType": "Observation",
"id": "heart-rate",
"meta": {
"profile": [
"http://hl7.org/fhir/StructureDefinition/vitalsigns"
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "vital-signs",
"display": "Vital Signs"
}
],
"text": "Vital Signs"
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "8867-4",
"display": "Heart rate"
}
],
"text": "Heart rate"
},
"subject": {
"reference": "Patient/example"
},
"effectiveDateTime": "2020-04-21T00:00:00+05:30",
"valueQuantity": {
"value": 97,
"unit": "beats/minute",
"system": "http://unitsofmeasure.org",
"code": "/min"
}
}
# Hour 2
{
"resourceType": "Observation",
"id": "heart-rate",
"meta": {
"profile": [
"http://hl7.org/fhir/StructureDefinition/vitalsigns"
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "vital-signs",
"display": "Vital Signs"
}
],
"text": "Vital Signs"
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "8867-4",
"display": "Heart rate"
}
],
"text": "Heart rate"
},
"subject": {
"reference": "Patient/example"
},
"effectiveDateTime": "2020-04-21T01:00:00+05:30",
"valueQuantity": {
"value": 89,
"unit": "beats/minute",
"system": "http://unitsofmeasure.org",
"code": "/min"
}
}
I created a resource bundle with 100 jsons nested inside entry and i am able to push it inside fhir-server.
{"resourceType": "Bundle", "type": "batch", "entry": [
The example given above is for one patient and one observation resource (heart-rate). I have more than 20000 patients with 50 different observation resource types.
Instead of creating 100 different json entries , is there any way to have one json representing 100 values. in value quantity if there is any way to have array of values mapped with timestamp. It would save lot of time.

For a single observation type and a single subject, if the observations are being made on a regular periodic basis, you can use the SampledData data type as the Observation.value. Typically that's for things like EKGs, fetal heart rate monitors, etc. which are sampling on a frequent basis, but nothing stops you from having a sampling period of an hour. However, if you don't have regular sampling, you must capture each as a distinct Observation. The reason is that we need to be able to extract the data however the user chooses to query it. The data needs to come in with the same sort of fine-grained organization that it might later need to go out. You might look at the Bulk Data API which uses LD-JSON to allow more efficient processing of large volumes of data.

Related

FHIR to OMOP Mapping Question: Blood pressure systolic and diastolic with unmapped, not valid code (55284-4)

There is a LOINC concept 55284-4 that appears in some FHIR resources, for example:
https://syntheticmass.mitre.org/v1/fhir/Patient/0000aa42-c235-4447-8389-8a2640f44466/$everything
This code is for "Blood pressure systolic and diastolic" and is in the OMOP concept table as shown below.
This concept is not a standard concept, is not a valid concept (from OMOP's perspective) and does not have a mapping to any standard concept in OMOP.
This concept appears in the FHIR resource in the snippet shown below (from the synthmass url shown above).
What records should be created in OMOP to represent the snippet shown below?
"resource": {
"category": [
{
"coding": [
{
"code": "vital-signs",
"display": "vital-signs",
"system": http://hl7.org/fhir/observation-category
}
]
}
],
"code": {
"coding": [
{
"code": "55284-4",
"display": "Blood Pressure",
"system": http://loinc.org
}
],
"text": "Blood Pressure"
},
"component": [
{
"code": {
"coding": [
{
"code": "8462-4",
"display": "Diastolic Blood Pressure",
"system": http://loinc.org
}
],
"text": "Diastolic Blood Pressure"
},
"valueQuantity": {
"code": "mmHg",
"system": http://unitsofmeasure.org,
"unit": "mmHg",
"value": 84.88290301982099
}
},
{
"code": {
"coding": [
{
"code": "8480-6",
"display": "Systolic Blood Pressure",
"system": http://loinc.org
}
],
"text": "Systolic Blood Pressure"
},
"valueQuantity": {
"code": "mmHg",
"system": http://unitsofmeasure.org,
"unit": "mmHg",
"value": 117.69213707496547
}
}
],
"context": {
"reference": "Encounter/52430cb1-a0d3-4d1e-926c-c878c218502e"
},
"effectiveDateTime": "2018-05-06T04:07:24-04:00",
"id": "186e8672-f9ac-4419-8c5d-1e824bf6e536",
"issued": "2018-05-06T04:07:24.278-04:00",
"meta": {
"lastUpdated": "2019-04-09T08:36:08.363897+00:00",
"versionId": "MTU1NDc5ODk2ODM2Mzg5NzAwMA"
},
"resourceType": "Observation",
"status": "final",
"subject": {
"reference": "Patient/0000aa42-c235-4447-8389-8a2640f44466"
}
}
EDIT: ADDITIONAL INFORMATION
It looks like these are probably commonly used concepts for blood pressure in OMOP
select
*
from
concept
where 1=1
and (
lower(concept_name) = 'systolic blood pressure' or
lower(concept_name) = 'diastolic blood pressure')
and domain_id = 'Measurement'
and standard_concept = 'S';
And there are lots of other potential candidates (about 380 of them):
select
*
from
concept
where 1=1
and lower(concept_name) like '%blood pressure%'
and domain_id = 'Measurement'
and standard_concept = 'S';
I would map it the same as if it was LOINC code 85354-9. However, you should file an issue with Synthea because using the code 55284-4 without also having a translation of 85354-9 is non-conformant. (All FHIR conformant systems conveying a combined 'blood pressure' Observation are required to adhere to this profile, which mandates the 85354-9 code.)

How to link batch-response entries with the request entries in FHIR (DSTU3)

I am currently building an application for which it is important to check the existence of resources with a certain profile.
As we need to check this for 40+ profiles I'd like to put this all in 1 batch request and let our HAPI-FHIR server implementation handle this, as opposed to querying them one by one. This would get too chatty otherwise.
Because I only need to know about whether the resource exists I'd like to use _summary=count. I am assuming this increases the performance of the request.
Example request
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"request": {
"method": "GET",
"url": "/Observation?_profile=http://nictiz.nl/fhir/StructureDefinition/zib-DrugUse&_summary=true"
}
},
{
"request": {
"method": "GET",
"url": "/RelatedPerson?_profile=http://fhir.nl/fhir/StructureDefinition/nl-core-relatedperson&_summary=count"
}
}
]
}
Response
{
"resourceType": "Bundle",
"id": "fd66cfd9-4693-496d-86fc-98289067480b",
"type": "batch-response",
"link": [
{
"relation": "self",
"url": "<redacted>"
}
],
"entry": [
{
"resource": {
"resourceType": "Bundle",
"id": "2647a49f-0503-496b-b274-07d4e9163f1b",
"meta": {
"lastUpdated": "2021-02-15T11:44:18.035+00:00",
"tag": [
{
"system": "http://hl7.org/fhir/v3/ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
}
]
},
"type": "searchset",
"total": 48
},
"response": {
"status": "200 OK"
}
},
{
"resource": {
"resourceType": "Bundle",
"id": "2f9cc861-5d20-4da1-aa9f-12153b75539d",
"meta": {
"lastUpdated": "2021-02-15T11:44:18.151+00:00",
"tag": [
{
"system": "http://hl7.org/fhir/v3/ObservationValue",
"code": "SUBSETTED",
"display": "Resource encoded in summary mode"
}
]
},
"type": "searchset",
"total": 10
},
"response": {
"status": "200 OK"
}
}
]
}
Can I assume that the ordering of the batch-response is the same as that of the batch-request?
Or is there a method to annotate the batch entries which are persisted onto the batch-response?
Or finally, is there a flag I can turn on to make the response include the request.url part?
I'm using HAPI-FHIR 5.1.0 both for client and server.
Apparently I didn't look well enough in the specs, as I just found the following:
From the FHIR spec
For a batch, or a successful transaction, the response the server SHALL return a Bundle with type set to batch-response or transaction-response that contains one entry for each entry in the request, in the same order, with the outcome of processing the entry.

Gaussian constraint in `normfactor`

I would like to understand how to impose a gaussian constraint with central value expected_yield and error expected_y_error on a normfactor modifier. I want to fit observed_data with a single sample MC_derived_sample. My goal is to extract the bu_y modifier such that the integral of MC_derived_sample scaled by bu_y is gaussian-constrained to expected_yield +/- expected_y_error.
My present attempt employs the normsys modifier as follows:
spec = {
"channels": [
{
"name": "singlechannel",
"samples": [
{
"name": "constrained_template",
"data": MC_derived_sample*expected_yield, #expect normalisation around 1
"modifiers": [
{"name": "bu_y", "type": "normfactor", "data": None },
{"name": "bu_y_constr", "type": "normsys",
"data":
{"lo" : 1 - (expected_y_error/expected_yield),
"hi" : 1 + (expected_y_error/expected_yield)}
},
]
},
]
},
],
"observations": [
{
"name": "singlechannel",
"data": observed_data,
}
],
"measurements": [
{
"name": "sig_y_extraction",
"config": {
"poi": "bu_y",
"parameters": [
{"name":"bu_y", "bounds": [[(1 - (5*expected_y_error/expected_yield), 1+(5*expected_y_error/expected_yield)]], "inits":[1.]},
]
}
}
],
"version": "1.0.0"
}
My thinking is that normsys will introduce a gaussian constraint about unity on the sample scaled by expected_yield.
Please can you provide me any feedback as to whether this approach is correct, please?
In addition, suppose I wanted to include a staterror modifier for the Barlow-Beeston lite implementation, would this be the correct way of doing so?
"samples": [
{
"name": "constrained_template",
"data": MC_derived_sample*expected_yield, #expect normalisation around 1
"modifiers": [
{"name": "BB_lite_uncty", "type": "staterror", "data": np.sqrt(MC_derived_sample)*expected_yield }, #assume poisson error and scale by central value of constraint
{"name": "bu_y", "type": "normfactor", "data": None },
{"name": "bu_y_constr", "type": "normsys",
"data":
{"lo" : 1 - (expected_y_error/expected_yield),
"hi" : 1 + (expected_y_error/expected_yield)}
},
]
}
Thanks a lot in advance for your help,
Blaise

Creating Observation FHIR Json using hourly data

I have a data in the following format csv format
where HR is heart rate, O2Sat is Oxygen Saturation, Temp is temperaute, ICULOS as ICU Length of Stay(showing hour number ranges from 1 to 100).
Now, i am trying to convert this to FHIR format. Since All these things come under observation, i am creating an observation template. For each column i am able to find a sample json where i can feed in the value.
I am not really sure how to interpret hourly data in FHIR. EffectiveTime, EffectivePeriod keys are not taking integer values and eventually failing in FHIR validation.
{
"resourceType": "Observation",
"id": "heart-rate",
"meta": {
"profile": [
"http://hl7.org/fhir/StructureDefinition/vitalsigns"
]
},
"status": "registered",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "vital-signs",
"display": "Vital Signs"
}
],
"text": "Vital Signs"
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "8867-4",
"display": "Heart rate"
}
],
"text": "Heart rate"
},
"subject": {
"reference": "Patient/example"
},
"effectiveDateTime": "1999-07-02",
"valueQuantity": {
"value": 0,
"unit": "beats/minute",
"system": "http://unitsofmeasure.org",
"code": "/min"
}
}
Can someone help me with the format to include hourly data and also how the json would be nested with multiple columns present in the figure ?
NOTE: ICULOS - has entry upto 100 hours.. For each hour values are denoted.
You would have a separate Observation for each measurement for each hour (with an appropirate effectiveDateTime indicating the specific time of each measurement). For example, you might have an effectiveDateTime of "1999-07-02T03:57:15" for the first and "1999-07-02T05:01:22" for the next. If you have no clue what time the measurements were made at and just have an hourly list, then simply go with "1999-07-02T00:00:00", "1999-07-02T01:00:00", etc.

How can i create FHIR ValueSet with hierarchical content?

I want create ValueSet with link to my CodeSystem.
ValueSet expantion with enclosed contains should be like:
{
...
"expansion": {
"parameter": [
{
"name": "total",
"valueString": "282"
}
],
"contains": [
{
"code": "0",
"display": "asd",
"contains": [
{
"code": "High"
},
{
"code": "Okso",
"display": "1"
}
]
}
]
}
...
}
I tried to create CodeSystem with hierarchical concepts, and ValueSet with compose.include to my CodeSystem. But i getted expantion with 1 level contents like this:
"contains": [
{
"code": "0",
"display": "asd"
}, {
"code": "High"
}, {
"code": "Okso",
"display": "1"
}
]
I tried change different attributes CodeSystem, but this bring me no result.
Help me please with a simple example!

Resources