Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patient/{id}/$everything does not return related Contracts #3934

Open
joostas opened this issue Jun 18, 2024 · 3 comments
Open

Patient/{id}/$everything does not return related Contracts #3934

joostas opened this issue Jun 18, 2024 · 3 comments
Labels
Bug Bug bug bug. VSTS-Backlog On VSTS Backlog

Comments

@joostas
Copy link

joostas commented Jun 18, 2024

Describe the bug
Patient/{id}/$everything endpoint does not return related Contracts

FHIR Version?
R4

Data provider?
CosmosDB (Azure API for FHIR)

To Reproduce
Steps to reproduce the behavior:

  1. Create a Patient resource with payload
{
 "resourceType": "Patient",
 "id": "example",
 "text": {
   "status": "generated",
   "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t<table>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Name</td>\n\t\t\t\t\t\t<td>Peter James \n              <b>Chalmers</b> (&quot;Jim&quot;)\n            </td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Address</td>\n\t\t\t\t\t\t<td>534 Erewhon, Pleasantville, Vic, 3999</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Contacts</td>\n\t\t\t\t\t\t<td>Home: unknown. Work: (03) 5555 6473</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Id</td>\n\t\t\t\t\t\t<td>MRN: 12345 (Acme Healthcare)</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>"
 },
 "identifier": [
   {
     "use": "usual",
     "type": {
       "coding": [
         {
           "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
           "code": "MR"
         }
       ]
     },
     "system": "urn:oid:1.2.36.146.595.217.0.1",
     "value": "12345",
     "period": {
       "start": "2001-05-06"
     },
     "assigner": {
       "display": "Acme Healthcare"
     }
   }
 ],
 "active": true,
 "name": [
   {
     "use": "official",
     "family": "Chalmers",
     "given": [
       "Peter",
       "James"
     ]
   },
   {
     "use": "usual",
     "given": [
       "Jim"
     ]
   },
   {
     "use": "maiden",
     "family": "Windsor",
     "given": [
       "Peter",
       "James"
     ],
     "period": {
       "end": "2002"
     }
   }
 ],
 "telecom": [
   {
     "use": "home"
   },
   {
     "system": "phone",
     "value": "(03) 5555 6473",
     "use": "work",
     "rank": 1
   },
   {
     "system": "phone",
     "value": "(03) 3410 5613",
     "use": "mobile",
     "rank": 2
   },
   {
     "system": "phone",
     "value": "(03) 5555 8834",
     "use": "old",
     "period": {
       "end": "2014"
     }
   }
 ],
 "gender": "male",
 "birthDate": "1974-12-25",
 "_birthDate": {
   "extension": [
     {
       "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
       "valueDateTime": "1974-12-25T14:35:45-05:00"
     }
   ]
 },
 "deceasedBoolean": false,
 "address": [
   {
     "use": "home",
     "type": "both",
     "text": "534 Erewhon St PeasantVille, Rainbow, Vic  3999",
     "line": [
       "534 Erewhon St"
     ],
     "city": "PleasantVille",
     "district": "Rainbow",
     "state": "Vic",
     "postalCode": "3999",
     "period": {
       "start": "1974-12-25"
     }
   }
 ],
 "contact": [
   {
     "relationship": [
       {
         "coding": [
           {
             "system": "http://terminology.hl7.org/CodeSystem/v2-0131",
             "code": "N"
           }
         ]
       }
     ],
     "name": {
       "family": "du Marché",
       "_family": {
         "extension": [
           {
             "url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
             "valueString": "VV"
           }
         ]
       },
       "given": [
         "Bénédicte"
       ]
     },
     "telecom": [
       {
         "system": "phone",
         "value": "+33 (237) 998327"
       }
     ],
     "address": {
       "use": "home",
       "type": "both",
       "line": [
         "534 Erewhon St"
       ],
       "city": "PleasantVille",
       "district": "Rainbow",
       "state": "Vic",
       "postalCode": "3999",
       "period": {
         "start": "1974-12-25"
       }
     },
     "gender": "female",
     "period": {
       "start": "2012"
     }
   }
 ],
 "managingOrganization": {
   "reference": "Organization/1"
 }
}

Response payload:

{
    "resourceType": "Patient",
    "id": "6fad1f14-8b8a-4a8e-9223-e5b9329576c8",
   //...
}
  1. Create Contract resource with a subject referencing the Patient
{
                "resourceType": "Contract",
                "meta": {
                    "versionId": "1",
                    "lastUpdated": "2024-06-11T11:26:54.846+00:00",
                    "profile": [
                        "http://hl7.org/fhir/StructureDefinition/Contract"
                    ]
                },
                "subject": [
                    {"reference": "Patient/6fad1f14-8b8a-4a8e-9223-e5b9329576c8"}
                ],
                "identifier": [
                    {
                        "use": "usual",
                        "system": "https://local-system/Id/local-id",
                        "value": "LOCALIDHASHGOESHERE"
                    }
                ],
                "status": "appended"
 }

Response with payload:

{
    "resourceType": "Contract",
    "id": "0ad7d0a8-ceae-4b28-ac5e-d83188649a0b",
   //...
}
  1. Execute GET Patient/6fad1f14-8b8a-4a8e-9223-e5b9329576c8/$everything and iterate through all results
  2. No Contract is included
  3. Contract is returned if searching using GET /Contract?patient=6fad1f14-8b8a-4a8e-9223-e5b9329576c8

Expected behavior
GET Patient/6fad1f14-8b8a-4a8e-9223-e5b9329576c8/$everything includes related Contract into response

Actual behavior
GET Patient/{id}/$everything does not return related Contracts

@joostas joostas added the Bug Bug bug bug. label Jun 18, 2024
@EXPEkesheth
Copy link
Collaborator

@joostas - are you able to perform search on contract resource with reference to patient id of interest?
Search would look like: /Contract?patient=Patient/

@joostas
Copy link
Author

joostas commented Jun 25, 2024

@EXPEkesheth yes, if I search using this request GET /Contract?patient=6fad1f14-8b8a-4a8e-9223-e5b9329576c8 contract is returned.

Update:
Contact is found as well if I search using Patient/id (i.e. GET /Contract?patient=Patient/6fad1f14-8b8a-4a8e-9223-e5b9329576c8)

@EXPEkesheth
Copy link
Collaborator

Thanks for information. Have created workitem to investigate further #AB122530

@EXPEkesheth EXPEkesheth added the VSTS-Backlog On VSTS Backlog label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug bug bug. VSTS-Backlog On VSTS Backlog
Projects
None yet
Development

No branches or pull requests

2 participants