awslabs/fhir-works-on-aws-deployment

Storing bundle resource transaction and then querying Patient data

vcareit opened this issue · 7 comments

Describe the bug
I can successfully store a bundle transaction. Example below;

"
{
"id": "d12861b2-8059-47e8-a784-fedef53fbf0e",
"vid": 1,
"documentStatus": "AVAILABLE",
"entry": [
{
"fullUrl": "urn:uuid:c8f7307f-6074-49e9-adc3-eff315bce5d8",
"resource": {
"id": "c8f7307f-6074-49e9-adc3-eff315bce5d8",
"active": true,
"address": [
{
"city": "sdfsfd",
"country": "India",
"district": "sdfsfd",
"line": [
"asdasd",
"asdasd"
],
"postalCode": "123123",
"state": "asdasd",
"text": "To be Added",
"type": "physical",
"use": "home"
.....
.....
"

I then want to get the patient data by providing the below pattern

/Patient/c8f7307f-6074-49e9-adc3-eff315bce5d8

I get 404 resource not found error.

To Reproduce
Steps to reproduce the behavior:

  1. Create a bundle transaction with Patient and Observation.
    url: https://baseurl/bundle
  2. Store the values using app into the dynamodb
  3. call the url : https://baseurl/Patient/id
  4. 404 resource not found error.

Expected behavior
Get the Patient resource.

Hi,
By default, FHIR Works does not ingest id's provided within resources. Instead, it elects to create its own id's for them, and these will be returned with the response for the transaction bundle in the same order the requests within were provided. You can use that ID to query the resource.

Thanks,
Sukeerth

@ssvegaraju You are right the id for the entire bundle resource is created automatically, but the resources within the bundle transaction has ids assigned by me and its also reflected in the db json file.

My bundle transaction has : Patient, Observations and Conditions.

I want to fetch Patient out of this bundle when I have patient id. I also create a fullurl with patient-id as shown in my example above. FHIR supports this behaviour and ability to fetch the resources based on the ids.

Regards

@ssvegaraju any updates on this one ? Posting bundle requests on the baseURL or root url doesn't work either. What is the best possible way to post a bundle as transaction containing different resourceTypes ?

Ah I think I misunderstood your question at first. Can I see an example of what you were trying to post to the root URL? typically the above format you have should work (I don't see the request part of the entry but assume that's in the ommitted section?). An example Bundle could be something like:

{
    "resourceType": "Bundle",
    "type": "transaction",
    "entry": [
        {
            "fullUrl": "id",
            "resource": {
                "resourceType": "Condition",
                "id": "example",
                "meta": {
                    "profile": [
                        "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition"
                    ]
                },
                "text": {
                    "status": "generated",
                    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative</b></p><p><b>id</b>: example</p><p><b>meta</b>: </p><p><b>clinicalStatus</b>: <span title=\"Codes: {http://terminology.hl7.org/CodeSystem/condition-clinical active}\">Active</span></p><p><b>verificationStatus</b>: <span title=\"Codes: {http://terminology.hl7.org/CodeSystem/condition-ver-status confirmed}\">Confirmed</span></p><p><b>category</b>: <span title=\"Codes: {http://terminology.hl7.org/CodeSystem/condition-category problem-list-item}\">Problem</span></p><p><b>code</b>: <span title=\"Codes: {http://snomed.info/sct 442311008}\">Single liveborn, born in hospital</span></p><p><b>subject</b>: <a href=\"Patient-example.html\">Amy V. Shaw. Generated Summary: id: example; Medical Record Number: 1032702 (USUAL); active; Amy V. Shaw , Amy V. Baxter ; ph: 555-555-5555(HOME), amy.shaw@example.com; gender: female; birthDate: 1987-02-20</a></p><p><b>onset</b>: 2016-08-10</p></div>"
                },
                "clinicalStatus": {
                    "coding": [
                        {
                            "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
                            "code": "active",
                            "display": "Active"
                        }
                    ],
                    "text": "Active"
                },
                "verificationStatus": {
                    "coding": [
                        {
                            "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
                            "code": "confirmed",
                            "display": "Confirmed"
                        }
                    ],
                    "text": "Confirmed"
                },
                "category": [
                    {
                        "coding": [
                            {
                                "system": "http://terminology.hl7.org/CodeSystem/condition-category",
                                "code": "problem-list-item",
                                "display": "Problem List Item"
                            }
                        ],
                        "text": "Problem"
                    }
                ],
                "code": {
                    "coding": [
                        {
                            "system": "http://snomed.info/sct",
                            "code": "442311008",
                            "display": "Liveborn born in hospital"
                        }
                    ],
                    "text": "Single liveborn, born in hospital"
                },
                "subject": {
                    "reference": "Patient/example",
                    "display": "Amy V. Shaw"
                },
                "onsetDateTime": "2016-08-10"
            },
            "request": {
                "method": "POST",
                "url": "/Condition"
            }
        }
    ]
}

this, posted to <API_URL>/ will post the bundle, and create the Condition resource. The response will be a bundle that contains the results for each entry (in this case a 201 Created, with the id of the resource). Let me know if i understood that right.

Hi,

I basically create a bundle request where I add . Patient ResourceType, Observation,etc. In the backend the bundle is stored with a bundle id and each resourceType has an id which I assign. Now I want to fetch the Observations related to a patient from this bundle. That's where my problem is.

I have pasted the examples in the original query.

Regards
Aman

In FWoA, when creating a new resource in a transaction, we assign the resource a random uuid as seen in this method which is used when generating the Batch requests.

Based on the documentation here, it states "When processing a "POST" (create), the full URL is treated as the id of the resource on the source, and is ignored; the server generates an id for the resource."

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.