Can I have two modifiers in the same request parameter? - hl7-fhir

We are trying to create a #Search method in a FHIR Server to look for all the observations from a Patient. I have seen that the parameter can be subject or patient. We want that you could look for a Patient by Identifier, so the request should be something like this:
GET [base]/Observation?subject:identifier=http://acme.org/fhir/identifier/mrn|123456
or
GET [base]/Observation?patient:identifier=http://acme.org/fhir/identifier/mrn|123456
Our problem is that we only have Patient Identifiers with type. In order to look for a Patient by Identifier with type, you have to add the modifier :of-type. My question is, is correct to have a request with two modifiers? Just like the example below
GET [base]/Observation?patient:identifier:of-type=http://terminology.hl7.org/CodeSystem/v2-0203|MR|446053

Modifiers modify the default search behaviour, not the filter that you want to put on the resource type. You can only use modifier specified by FHIR. They are listed on this page: http://hl7.org/fhir/search.html.
Your first two searches above are not valid. In order to search Observations based on a patient's identifier, you would have to do a chained search:
GET [base]/Observation?patient.identifier=http://acme.org/fhir/identifier/mrn|123456
This is a shortcut for 'subject' with a resource type modifier:
GET [base]/Observation?subject:Patient.identifier=http://acme.org/fhir/identifier/mrn|123456
If you need to incorporate the 'of-type' modifier, the search could look like this:
GET [base]/Observation?patient.identifier:of-type=[codesystem_for_type]|MR|123456
I prefer to use the 'patient' parameter whenever applicable, but it would also be valid to do subject:Patient.identifier:oftype. Edit to add: for now it is valid, but see Lloyd's answer for future FHIR versions.

Based on https://jira.hl7.org/browse/FHIR-20641, the intention is to clarify that multiple modifiers are prohibited and that if you have that requirement, you need to define your own search parameter that doesn't require modifiers. Note that this decision has not yet passed ballot. In R4, there is no documented expectation for support, but there's no prohibition either. In practice, we're not aware of any standard servers that provide support and, given the planned prohibition in R5, it's unlikely such support will be built.

Related

Why does protobuf's FieldMask use field names instead of field numbers?

In the docs for FieldMask the paths use the field names (e.g., foo.bar.buzz), which means renaming the message field names can result in a breaking change.
Why doesn't FieldMask use the field numbers to define the path?
Something like 1.3.1?
You may want to consider filing an issue on the GitHub protocolbuffers repo for a definitive answer from the code's authors.
Your proposal seems logical. Using names may be a historical artifact. There's a possibly relevant comment on an issue thread in that repo:
https://github.com/protocolbuffers/protobuf/issues/3793#issuecomment-339734117
"You are right that if you use FieldMasks then you can't safely rename fields. But for that matter, if you use the JSON format or text format then you have the same issue that field names are significant and can't be changed easily. Changing field names really only works if you use the binary format only and avoid FieldMasks."
The answer for your question lies in the fact FieldMasks are a convention/utility developed on top of the proto3 schema definition language, and not a feature of it (and that utility is not present in all of the language bindings)
While you’re right in your observation that it can break easily (as schemas tend evolve and change), you need to consider this design choice from a user friendliness POV:
If you’re building an API and want to allow the user to select the field set present inside the response payload (the common use case for field masks), it’ll be much more convenient for you to allow that using field paths, rather then binary fields indices, as the latter would force the user of the gRPC/protocol generated code to be “aware” of the schema. That’s not always the desired case when providing API as a code software packages.
While implementing this as a proto schema feature can allow the user to have the best of both worlds (specify field paths, have them encoded as binary indices) for binary encoding, it would also:
Complicate code generation requirements
Still be an issue for plain text encoding.
So, you can understand why it was left as an “external utility”.

Is there a Search parameter Modifier for querying a value against a fixed position('first' or 'last') of an array-like element in a Resource?

I want to filter Encounters based on their first or last Encounter.location[].
FHIR REST api spec has only 1 search param related to Encounter location value: location and it doesn't specify the search behaviour in case when Cardinality is greater than 1.
I was hoping for a modifier suffix like :first or :last to support location:first, location:last i.e
{base_url}/Encounter?location:last=Location/123
but there is no such option and I don't see a way to add custom parameter modifiers.
Is there a preferred way than adding custom search params like location-last, location-first ?
Thanks!
The first thing to be aware of is that order is only significant when the base FHIR specification declares it to be significant - which it doesn't for Encounter.location. As a result, you should expect the locations to be listed in arbitrary order and the 'first' location won't mean anything special. The period of time when a location is/was relevant is conveyed by Encounter.location.period, not ordering within the collection. It's non-conformant to enforce any rules about ordering when FHIR hasn't defined any.
There are currently no qualifiers to support searching on a specific repetition. However, it is possible to define custom search parameters that can be tied to a specific repetition. E.g. If you wanted to only search on a patient's "first" name as opposed to all given names. Be aware that defining custom search parameters is only useful if you're in an environment where you can nudge both clients and servers to support the custom parameter.
You could submit a change request (use the link at the bottom of any page in the spec) proposing the :first and :last modifiers for inclusion in R5 of FHIR, but you'd have to provide several examples of places where it would be useful (constrained to places where order is actually significant)

HL7 FHIR mark resources as anonymized

I am trying to map an existing domain into HL7 FHIR.
So far it was pretty easy to find FHIR resources that more or less represent the same data and can be used for that purpose. But now I am running into a problem of which I am not sure how to solve it.
The existing domain allows that data can be anonymized depending on the users access level. e.g. a patient's name or address might be removed and marked as anonymized. Other data will be pseudonymised, for example a the birthdate in 1980 will be replaced with 01.01.1980. An Age of 37 will be replaced with a category of 30-40.
So I am unsure how to integrate that into the FHIR domain. I was thinking I could create an extension holding a boolean, indicating if a value was anonymized or not and always replace or remove the original value. This might work, but I will run into big problems when the anonymized value is of a different type than the original value (e.g. Age is replaced by a range of values)
Is that even a valid approach? I thought this might be common problem, but I could not find any examples where people described methods of how to mark data as altered. Unfortunately the documentation at http://build.fhir.org/extensibility-registry.html does not contain anything that would help my case.
You can use security labels for this purpose (Resource.meta.security). Take a look at REDACTED and SUBSETTED in the security label value set: https://www.hl7.org/fhir/valueset-security-labels.html
If you need to convey a data type other than the one allowed by the resource (e.g. wanting to convey a range rather than a birthdate), you'd need to use an extension. (Note that dates are valid even if you only include the year.)

Google Place API keyword vs name

I am using the Google Places API and I am making a request that looks like this.
https://maps.googleapis.com/maps/api/place/radarsearch/json?location=[LOCATION]&radius=500&keyword=[STORE_NAME]&key=[API_KEY]
The issue is that when I use the keyword in the request, the keyword looks for the value I provide in the name, address and anywhere else in the google content for a place. How can I do it so that I can give the store name and have it only search in the name field. I don't care about looking in the address.
Let me know if this doesn't make sense.
Places API Radar Search has just been deprecated, and will be retired in a year.
Please see full details in blog post Removing Place Add, Delete & Radar Search features.
On a related note, for both Radar Search and Nearby Search, the name parameter is just equivalent to keyword:
name — A term to be matched against all content that Google has indexed for this place. Equivalent to keyword. The name field is no longer restricted to place names. Values in this field are combined with values in the keyword field and passed as part of the same search string. We recommend using only the keyword parameter for all search terms.

Can't figure out how to search LOINC using FHIR for a specific test by name?

Can anyone provide some insight on the required syntax to use to search LOINC using FHIR for a specific string in the labs descriptive text portion of an Observation resource?
Is this even possible?
The documentation is all over the place and I can't find an example for this generic kind of search.
I found similar examples here: https://www.hl7.org/fhir/2015Sep/valueset-operations.html
Such as: GET "[base]/ValueSet/23/$validate-code?system=http://loinc.org&code=1963-8&display=test"
But none of them are providing a general enough case to do a global search of the LOINC system for a specific string in an Observation resource.
None of my attempts to use the FHIR UI here, http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/search?serverId=gatechreadonly&resource=Observation , have been successful. I keep getting a 500 Internal Server Error because I don't know the correct syntax to use for the value part of the search, and I can't find any documentation out of all the copious documents online that explains this very simple concept.
Can anyone provide some insight?
Totally frustrated at this point.
Observation?code=12345-6
or
Observation?code=http://loinc.org|12345-6
where 12345-6 is whatever LOINC code you want to look for (e.g. 39802-4)
The second ensures you'll only match on LOINC codes as opposed to codes from other systems, though given the relatively unique format of LOINC codes, you're mostly safe without including that.
If you want to search for a set of codes, then you can separate the codes or the tuples with commas: E.g.
Observation?code=12345-6,12345-7
or
Observation?code=http://loinc.org|12345-6,http://loinc.org|123456
If you expect to search by a really long list of codes frequently, you can define a value set that includes all the desired codes and then filter by value set:
Observation?code:in=http://somwhere.org/whatever/ValueSet/123
Note: for readability, I haven't escaped the URL contents, but you'll need to escape the URL values appropriately.

Resources