Stream: implementers
Topic: Q about code system
Lital Inghel (Mar 30 2022 at 14:59):
why is there difference between http://hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-server.html#immunization
GET [base]/Immunization?patient=[patient]&status=[status]
and http://hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-immunization.html
GET [base]/Immunization?patient=[reference]&status={system|}[code]
difference is in the code system:
status={system|}[code] versus status=[status]
why?
Gino Canessa (Mar 30 2022 at 15:25):
Likely just typing convention/clarity/copy-paste/etc.
The status
search parameter is defined as type token
, so including the system is optional. Given that Immunization.status
has a required binding to the ImmunizationStatusCodes value set, and that the value set only includes codes from a single code system, it is generally not necessary.
Lital Inghel (Mar 30 2022 at 15:35):
this is really confusing and it is all over the IG.
so what about Encounter type token
in http://hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-server.html#encounter
it says:
GET [base]/Encounter?patient=[patient]&type=[system]|[code]
versus
GET [base]/Encounter?patient=[reference]&type={system|}[code]
in
http://hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-encounter.html
so which query is correct?
type=[system]|[code] or {system|}[code]?
Michele Mottini (Mar 30 2022 at 15:44):
They are all token search parameter, they all have the same structure, that is in the base FHIR specs - what is confusing?
Lital Inghel (Mar 30 2022 at 15:45):
what is the correct query:
GET [base]/Encounter?patient=[patient]&type=[system]|[code]
versus
GET [base]/Encounter?patient=[reference]&type={system|}[code]
Gino Canessa (Mar 30 2022 at 15:45):
Technically, the token
search parameter is defined (here) so that both are allowed. The difference is that if you do not include a system, the code could be a value from another system that has the same code. For example, if you have patients with both http://example.org/codesystem/what_I_want#code
and http://example.org/codesystem/bad_system#code
, passing in just code
will match either, but passing in the system allows you to distinguish between them.
In cases where there is only a single system possible (e.g., a required binding that only has codes from a single system), there is no difference other than syntax.
That said, if you are finding it hard to differentiate in US Core, I would suggest filing a ticket asking for consistency in the examples.
Lital Inghel (Mar 30 2022 at 15:45):
{} vs [] has different meaning
Gino Canessa (Mar 30 2022 at 15:47):
The curly braces are just showing optionality. Token always has it defined as optional, but in specific use cases it may be:
- not useful (e.g., required binding from one system)
- optional (e.g., multiple systems, but no code overlaps)
- required (e.g., known codes from multiple systems)
Lital Inghel (Mar 30 2022 at 15:50):
the curly is what i expected to see in the capability statement page of the IG. instead it is [].
Lital Inghel (Mar 30 2022 at 17:13):
also if token means the parameter can be either
code,
code+system,
system alone,
why system is not in curly {} as well?
Gino Canessa (Mar 30 2022 at 17:22):
(I assume you mean why is code not in curly braces)
Limitation of syntax - it is difficult to convey that multiple things are optional but at least one segment is required. The definition of the type has all the details (which is several paragraphs) and inline examples just do the best they can. Showing every combination on every example is not feasible.
Yunwei Wang (Apr 01 2022 at 19:43):
This syntax in profile is correct. Those in CapabilityStatement are "examples"
US Core v4.0 remove those examples (because they are confusing) and add a further clarification about that syntax:
When searching using the token type searchparameter (how to search by token), the syntax {system|}[code] means that the system value is optional for the client to supply.:
- The client SHALL provide at least a code value and MAY provide both the system and code values.
- The server SHALL support both.
Gino Canessa (Apr 01 2022 at 19:48):
I am not sure if US core is trying to restrict to that, but that is not generally true for token searches. All of the following are defined as valid:
[parameter]=[code]
(just code)[parameter]=[system]|[code]
(system and code)[parameter]=|[code]
(code that explicitly has no system)[parameter]=[system]|
(just system).
I am not sure of a way to express that in a single line, and asking IGs to express every combination every time does not feel realistic.
Yunwei Wang (Apr 01 2022 at 19:51):
Yes All four formats are valid. US Core requires server to support token search using the first two formats (ie code and system|code). Server can implement token search with all four formats.
Last updated: Apr 12 2022 at 19:14 UTC