FHIR - Contained Resources and Referencing - hl7-fhir

I am still new to FHIR and trying to connect the dots.
If I have a resource that I want to contain other resources, can I refer to it by element name (#myElementName) or do I need to use the contained resource id? (#myDeviceId).
I've included sample code below. What I would like to accomplish is to have a Basic resource that has two extensions: TestConfiguration(Device) and DigitalSample(ImagingStudy). I would like for both of these resources to be contained.
PS: I generated the code below using custom classes and the .net API.
Thank you much!
{
"resourceType": "TestInput",
"contained": [
{
"resourceType": "TestConfiguration",
"id": "TestConfigurationId",
"contained": [
{
"resourceType": "DeviceDefinition",
"modelNumber": "ABC123"
}
],
"definition": {
"reference": "#definition"
}
},
{
"resourceType": "DigitalSample",
"id": "DigitalSampleId"
}
],
"extension": [
{
"url": "http://MyOrganization.com/fhir/R4/StructureDefinition/Basic-TestConfiguration",
"valueReference": {
"reference": "#testConfiguration"
}
},
{
"url": "http://MyOrganization.com/fhir/R4/StructureDefinition/Basic-DigitalSample",
"valueReference": {
"reference": "#digitalSampleId"
}
}
]
}

Every local reference must point to an id of a contained resource.
In your case it should be:
"reference": "#TestConfigurationId"
"reference":"#DigitalSampleId"
Always check https://www.hl7.org/fhir/ for what you need to do. Always check the FHIR version

Related

Reverse chaining in FHIR

I want to do a search in HAPI FHIR server as follows:
Retrive Observation resources that are referenced in .has-member of other Observation resources that have a specific .device id.
Example:
"resourceType": "Observation",
"device": {
"reference": "Device/2412"
},
"hasMember": [
{
"reference": "Observation/1"
},
{
"reference": "Observation/2"
},
{
"reference": "Observation/3"
}
]
And I'd like to get Observation/1, Observation/2, and Observation/3
Using reverse chaining (_has):
Observation?_has:Observation:has-member:device=Device/2412
That is, get Observation resources where another Observation with device=Device/2412 refers to this resource through has-member.
This uses the definition of _has http://hl7.org/fhir/search.html#has and the search parameters on Observation http://hl7.org/fhir/observation.html#search

Searching for Patient within a Bundle

We use Bundles to contain other resources. I want to search for bundles based on these nested resources. e.g. I have bundles that look like this:
{
"resourceType": "Bundle",
"type": "collection",
"entry": [
{
"resource": {
"resourceType": "Patient",
"identifier": [
{
"type": {
"coding": [
{
"code": "foo"
}
]
},
"value": "12345"
},
{
"type": {
"coding": [
{
"code": "bar"
}
]
},
"value": "abcde"
}
]
}
},
{
"resource": {
"resourceType": "SomeOtherResource"
}
}
]
}
I want to find all bundles which have Patient with "bar" == "abcde". There will be many such bundles and each Patient will have many identifiers other than "bar"
I've looked through https://www.hl7.org/fhir/search.html, but all the examples I find assume that (e.g.) Patient is at the top level and I can search with [base]/Patient?..., but I am looking for Bundles. I've looked through the search parameters here but those don't include any "contained" entries.
I've tried all the combinations of bundle/patient/identifier I can think of with no luck. Is this even supported?
If your Bundle is a FHIR Document or FHIR Message, you can search by chaining through the 'composition' or 'message' search parameter. Otherwise, there's no standard way to search. In general, content within a Bundle is opaque.

Cannot save a very simple fhir patient bundle

I am trying to save this very simple fhir patient bundle against https://vonk.fire.ly/Bundle, by doing a PUT using Postman, however I am not able to get it working. When I simply copy the inner Patient resource data and do a PUT directly to the https://vonk.fire.ly/Patient endpoint it works just fine (for example - I just did it to this url https://vonk.fire.ly/Patient/deb7338181).
Can someone please please point me in the direction of what exactly it is going wrong here in this bundle??
{
"resourceType": "Bundle",
"id": "b6ec685a-26a2-4bb3-814b-841fba6a6edb",
"meta": {
"lastUpdated": "2018-05-29T23:45:32Z"
}
"type": "transaction",
"entry": [
{
"resource": {
"resourceType": "Patient",
"id": "deb73381811",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Some narrative</div>"
},
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers1",
"given": [
"Peter1",
"James1"
]
}
],
"gender": "male",
"birthDate": "1974-12-25"
},
"request": {
"method": "POST",
"url": "Patient"
}
}
]
}
If you want to send a transaction to a FHIR server, you do a POST of the transaction Bundle to the endpoint, just like you mention in your comment. Within the transaction, for each entry you have to set the request part to the kind of request you want.
For your Patient entry you have asked the server to do a POST, which means a create with a server assigned ID. If you want the server to use your own ID, you should instruct it to perform a PUT, which is usually an update, but can also be used for create with your own ID.
The syntax for the update request is:
"request": {
"method": "PUT",
"url": "Patient/<my_patient_id>"
}
Please note that although it is a valid FHIR request and Vonk allows it, not all servers will.

Missing elements for a Google Cloud Video Annotation request

I am trying to run annotation on a video using the Google Cloud Video Intelligence API. Annotation requests with just one feature request (i.e., one of "LABEL_DETECTION", "SHOT_CHANGE_DETECTION" or "EXPLICIT_CONTENT_DETECTION"), things work fine. However, when I request an annotation with two or more features at the same time, the response does not always return all the request feature fields. For example, here is a request I ran recently using the API explorer:
{
"features": [
"EXPLICIT_CONTENT_DETECTION",
"LABEL_DETECTION",
"SHOT_CHANGE_DETECTION"
],
"inputUri": "gs://gccl_dd_01/Video1"
}
The operation Id I got back is this: "us-east1.11264560501473964275". When I run a GET with this Id, I have the following response:
200
{
"name": "us-east1.11264560501473964275",
"metadata": {
"#type": "type.googleapis.com/google.cloud.videointelligence.v1.AnnotateVideoProgress",
"annotationProgress": [
{
"inputUri": "/gccl_dd_01/Video1",
"progressPercent": 100,
"startTime": "2018-08-06T17:13:58.129978Z",
"updateTime": "2018-08-06T17:18:01.274877Z"
},
{
"inputUri": "/gccl_dd_01/Video1",
"progressPercent": 100,
"startTime": "2018-08-06T17:13:58.129978Z",
"updateTime": "2018-08-06T17:14:39.074505Z"
},
{
"inputUri": "/gccl_dd_01/Video1",
"progressPercent": 100,
"startTime": "2018-08-06T17:13:58.129978Z",
"updateTime": "2018-08-06T17:16:23.230536Z"
}
]
},
"done": true,
"response": {
"#type": "type.googleapis.com/google.cloud.videointelligence.v1.AnnotateVideoResponse",
"annotationResults": [
{
"inputUri": "/gccl_dd_01/Video1",
"segmentLabelAnnotations": [
...
],
"shotLabelAnnotations": [
...
],
"shotAnnotations": [
...
]
}
]
}
}
The done parameter for the response is set to true, but it does not have any field containing the annotations for Explicit Content.
This issue seems to be occurring at random to my novice eyes. The APIs will return a response with all parameters on some occasions and be missing one on others. I am wondering if there is anything I am missing here or something on my end that is causing this?
I did some tests using just LABEL_DETECTION, just EXPLICIT_CONTENT_DETECTION and using the three of them.
As I am not using videos with explicit content, I don't see any specific field when adding just EXPLICIT_CONTENT_DETECTION:
{
"name": "europe-west1.462458490043912485",
"metadata": {
"#type": "type.googleapis.com/google.cloud.videointelligence.v1.AnnotateVideoProgress",
"annotationProgress": [
{
"inputUri": "/cloud-ml-sandbox/video/chicago.mp4",
"startTime": "2018-08-07T14:18:40.086713Z",
"updateTime": "2018-08-07T14:18:40.230351Z"
}
]
}
}
Can you share a specific video sample, the request.json used and two different outputs, please?

FHIR DSTU2: What is the correct way to represent an extension value as a collection?

I'm currently looking into creating a FHIR DSTU2 extension. I need the extension to return a collection of values. What is the correct way to represent this in FHIR DSTU2?
Should it be a list of extensions within an extension:
"resource": {
"resourceType": "Medication",
"extension": [
{
"url": "http://www.myextension.com/strengths",
"extension": [
{
"url": "http://www.myextension.com/strength",
"valueStrength": "5mg"
},
{
"url": "http://www.myextension.com/strength",
"valueStrength": "20mg"
}
]
}
],
}
Or should it be one extension with a collection on the value?
"resource": {
"resourceType": "Medication",
"extension": [
{
"url": "http://www.emis-online.com/strengths",
"valueStrengths": [
"5mg",
"20mg"
],
}
],
}
Thanks.
It would actually look like this:
"resource": {
"resourceType": "Medication",
"extension": [
{
"url": "http://www.myextension.com/strength",
"valueString": "5mg"
},
{
"url": "http://www.myextension.com/strength",
"valueString": "20mg"
}
]}
As well, it'd be better to use valueQuantity than valueString - to split the value and the unit.
That said, there's no reason to use an extension for drug strengths at all. Medication.product.ingredient.amount is strength - if the ingredient is an active ingredient. (I see that the resource doesn't currently allow distinguishing active from excipient ingredients, so I'd encourage raising a change request on that.)

Resources