FHIR Chat · searching for subject:identifier · hapi

Stream: hapi

Topic: searching for subject:identifier


view this post on Zulip Bob Milius (Aug 24 2020 at 14:06):

I posted this to Implementers thread, and it was suggested that I post it here.

I can successfully create this resource on http://hapi.fhir.org/baseR4/

<Observation>
    <subject>
        <identifier>
            <system value="http://acme.org/identifier/mrn" />
            <value value="123" />
        </identifier>
    </subject>
</Observation>

(a Patient resource does not exist)
and then I attempt to search for it using
GET http://hapi.fhir.org/baseR4/Observation?subject:identifier=http://acme.org/identifier/mrn|123
but it doesn't find anything. Is this expected behavior?
How would I search for Observation.subject.identifier?

view this post on Zulip Marian Hummel (Sep 22 2020 at 06:16):

In case you are still looking for an answer:

First, the identifier does not belong into subject. Subject is a reference parameter to "Who and/or what the observation is about"
https://www.hl7.org/fhir/observation.html

I created your Observation and found it with
./Observation?identifier=123

But i guess there are better ways.

view this post on Zulip René Spronk (Sep 22 2020 at 07:06):

Actually, it should be http://hapi.fhir.org/baseR4/Observation?patient.identifier=http://acme.org/identifier/mrn|123 (. instead of : - parameter chaining is based on the . separator, and use the patient parameter (a Patient type resource) rather than the subject parameter (subject is mostly a Patient, but could be another resource type))

view this post on Zulip Bob Milius (Feb 25 2021 at 17:57):

Sorry, I just noticed there were replies to this.

Marian Hummel said:

In case you are still looking for an answer:

First, the identifier does not belong into subject. Subject is a reference parameter to "Who and/or what the observation is about"
https://www.hl7.org/fhir/observation.html

I created your Observation and found it with
./Observation?identifier=123

But i guess there are better ways.

Yes, we are getting observations reported to us with a given subject identifier from external organizations. It is an observation about a patient using a research identifier (de-identified). So there may be multiple observations about the same patient identifier. But they wouldn't know if a Patient resource has already been created or its id, so we are asking them to use observation.subject.identifier instead of observation.subject.reference. It seems like we should be able to search for Observations with a subject identifier. Since subject is a reference data type, seems like observation.subject should be able to be an identifier and I should be able to search for it.
image.png

view this post on Zulip Bob Milius (Feb 25 2021 at 18:22):

René Spronk said:

Actually, it should be http://hapi.fhir.org/baseR4/Observation?patient.identifier=http://acme.org/identifier/mrn|123 (. instead of : - parameter chaining is based on the . separator, and use the patient parameter (a Patient type resource) rather than the subject parameter (subject is mostly a Patient, but could be another resource type))

Sorry, but this isn't working for me either. I don't necessarily have a Patient resource. Here's a more complete example:

{
    "resourceType": "Observation",
    "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": "9279-1",
                "display": "Respiratory rate"
            }
        ],
        "text": "Respiratory rate"
    },
    "subject": {
        "identifier": {
            "system": "http://example.org/identifier",
            "value": "1234567"
        }
    },
    "effectiveDateTime": "1999-07-02",
    "valueQuantity": {
        "value": 26,
        "unit": "breaths/minute",
        "system": "http://unitsofmeasure.org",
        "code": "/min"
    }
}

I can upload this to hapi.fhir.org/baseR4 (see http://hapi.fhir.org/baseR4/Observation/1865320)
but I can't seem search for it based on the subject.identifier or subject:identifer or patient.identifer, or at least I don't know how. It seems I should be able to search for Observations based on subject identifier even if the Patient resource doesn't yet exist.

view this post on Zulip Dexter (Feb 26 2021 at 10:32):

I tried all these combinations

http://hapi.fhir.org/baseR4/Observation?subject:identifier=http://example.org/identifier|1234567
http://hapi.fhir.org/baseR4/Observation?subject:identifier=http://example.org/identifier|
http://hapi.fhir.org/baseR4/Observation?subject.identifier=http://example.org/identifier|123456
http://hapi.fhir.org/baseR4/Observation?subject.identifier=http://example.org/identifier|
http://hapi.fhir.org/baseR4/Observation?_filter=subject.identifier eq http://example.org/identifier|123456
http://hapi.fhir.org/baseR4/Observation?_filter=subject.identifier eq http://example.org/identifier|

From my understanding, chaining (subject.identifier) will try to resolve the reference, so subject:identifier (I think these are called Logical references?) seems the way to go. But doesn't work unfortunately.

view this post on Zulip René Spronk (Feb 26 2021 at 11:38):

If you use a reference from e.g. an Observation to a Patient using reference.identifier (instead of reference.reference), there's not an expectation that the server will support parameter chaining. So that's probably the issue that you're running into.

view this post on Zulip Bob Milius (Feb 26 2021 at 17:41):

My understanding is that if a patient resource exists and is known, then observation.subject should be a reference, e.g.,

"subject": {
    "reference": "Patient/123"
}

and then to find Observations of that subject, use

Observation?subject.identifier=http://example.org/identifier|1234567

But if you don't have a Patient resource, then observation.subject could be an identifier, e.g.,

"subject": {
    "identifer": {
        "system": "http://example.org/identifier",
        "value": "1234567"
    }
}

and then to find Observations of that subject, use

Observation?subject:identifier=http://example.org/identifier|1234567

This second method (using subject:identifier instead of subject.identifier) doesn't seem to work.

view this post on Zulip Kevin Mayfield (Feb 27 2021 at 21:38):

I've been wondering if we need more guidance on the use of reference identifiers. I am in favour of using them between systems/providers (interop) but maybe not for client server interactions.

view this post on Zulip DT (Aug 24 2021 at 01:35):

            "resourceType": "RiskAssessment",
            "id": "1",
            "meta": {
                ...
            },
            "identifier": [
                {
                    "system": "...",
                    "value": "..."
                }
            ],
            "status": "final",
            "subject": {
                "identifier": {
                    "system": "http://myapp.com/patient-mrn",
                    "value": "99"
                }
            },
            "prediction": [{...}]

Trying to query for RiskAssessment GET /RiskAssessment?subject:identifier=http://myapp.com/patient-mrn%7C99
but getting an empty bundle back. Any ideas what's wrong here?

view this post on Zulip John Silva (Aug 24 2021 at 14:22):

A couple of things, first for any FHIR search you'll want to consult the FHIR spec page (near the bottom) for the specifics about which search parameters a particular resource supports: https://www.hl7.org/fhir/riskassessment.html#search

In your case the subject is the "field name" within the resource but the search parameter is 'patient'. (An FYI, most all search parameters are all lowercase and not the same as the name of the field in the resource).

So, I believe your search should look like this: /RiskAssessment?patient=identifier=http://myapp.com/patient-mrn%7C99

[Also, you are using the urlencoded version of vertical bar "|", normally a FHIR server would expect the vertical bar not the urlencoded version so it probably should be: /RiskAssessment?patient=identifier=http://myapp.com/patient-mrn|99 ]

view this post on Zulip Pavel Khromov (Oct 12 2021 at 10:57):

Hello all!
@René Spronk and @John Silva could someone post here working example with using modifier :identifier for reference type element?

I'm trying to search Patient (http://hapi.fhir.org/baseR4/Patient/2639722) resource with next body:

{
      "resourceType": "Patient",
      "id": "2639722",
      "meta": {
        "versionId": "1",
        "lastUpdated": "2021-10-12T10:49:47.309+00:00",
        "source": "#bkRo4gg3Ap4kaCgo"
      },
      "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">Ms Charlene MN123 <b>THERON </b> Sr </div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>MR1039</td></tr><tr><td>Date of birth</td><td><span>06 October 2001</span></td></tr></tbody></table></div>"
      },
      "identifier": [ {
        "type": {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
            "code": "MR",
            "display": "Medical record number"
          } ]
        },
        "system": "https://radboud.nl/identifiers/PatientIdentifier",
        "value": "MR1039"
      } ],
      "name": [ {
        "use": "usual",
        "family": "Theron",
        "given": [ "Charlene", "MN123" ],
        "prefix": [ "Ms" ],
        "suffix": [ "Sr" ]
      }, {
        "use": "usual",
        "family": "ALLN1",
        "given": [ "ALFN1" ]
      } ],
      "gender": "male",
      "birthDate": "2001-10-06",
      "contact": [ {
        "relationship": [ {
          "coding": [ {
            "system": "http://terminology.hl7.org/CodeSystem/v2-0131",
            "code": "N",
            "display": "Next-of-Kin"
          } ]
        } ],
        "name": {
          "family": "Monkey-Magic R",
          "given": [ "Ruchir", "M" ]
        }
      } ],
      "managingOrganization": {
        "identifier": {
          "system": "http://systemIdentifier.org",
          "value": "sp13"
        }
      }
    }

using request
GET http://hapi.fhir.org/baseR4/Patient?organization:identifier=http://systemIdentifier.org|sp13

and i'm getting next

{
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre/></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "processing"
        }
    ]
}

then i'm trying using . intead of :
GET http://hapi.fhir.org/baseR4/Patient?organization.identifier=http://systemIdentifier.org|sp13

and i'm getting next

{
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>ERROR: canceling statement due to user request</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "ERROR: canceling statement due to user request"
        }
    ]
}

What should i do to get response?

view this post on Zulip Jens Villadsen (Oct 12 2021 at 11:07):

@Kevin Dougan it looks like a bug on the test site

view this post on Zulip Kevin Mayfield (Oct 12 2021 at 14:33):

Yes I'm seeing the same fault on most of the chained parameters I've tried

view this post on Zulip John Silva (Oct 12 2021 at 19:49):

@Pavel Khromov - looking at the data the managingOrgamization is NOT a proper reference (I believe); it should be something like:

"managingOrganization": { "reference": "https://server.fire.ly/r4/Organization/1ee3cbd8-c0fd-442e-bffa-83e213e7d734" },

If I perform this search on the Firely public R4 server it works as expected:

https://server.fire.ly/r4/Patient?_format=json&organization=1ee3cbd8-c0fd-442e-bffa-83e213e7d734

I did find this Patient on the HAPI public server that does have a 'proper' managingOrganization reference:

https://hapi.fhir.org/baseR4/Patient?_count=100&_id=1612407

However, searching for it with the organization search parameter still didn't work. I suggest asking @James Agnew , the author of HAPI for some advice.

view this post on Zulip Bob Milius (Oct 13 2021 at 18:31):

The data type for Patient.managingOrganization is Reference. And Reference doesn't have to have an literal reference, but can contain a logical identifier when the literal reference is not known.
image.png
https://www.hl7.org/fhir/references.html#Reference

Given this, having managingOrganization be represented as simply with an Identifier should be acceptable. I think the :identifier modifer is supposed to be allow a search based on that. The problem is that HAPI doesn't support that search.

view this post on Zulip Swetha Kumar (Nov 08 2021 at 22:39):

Did HAPI stop supporting the search by identifier recently?


Last updated: Apr 12 2022 at 19:14 UTC