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

Support token modifier ':of-type' #1323

Closed
JohnTimm opened this issue Jul 8, 2020 · 5 comments
Closed

Support token modifier ':of-type' #1323

JohnTimm opened this issue Jul 8, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request reindex Resolution of issue will require a $reindex during upgrade search showcase Used to Identify End-of-Sprint Demos

Comments

@JohnTimm
Copy link
Collaborator

JohnTimm commented Jul 8, 2020

From http://hl7.org/fhir/search.html#token:

:of-type The search parameter has the format system|code|value, where the system and code refer to a Identifier.type.coding.system and .code, and match if any of the type codes match. All 3 parts must be present

From Team discussion:

  1. Must look at extracting the parameter values and supporting the identifiers (token,code,system)
  2. Update logic to support search using those extracted values when of-type is used
@JohnTimm JohnTimm added the enhancement New feature or request label Jul 8, 2020
@prb112 prb112 added the search label Oct 9, 2020
@lmsurpre lmsurpre changed the title Add support for the "of-type" modifier per the FHIR search specification Support token modifier ':of-type' Nov 19, 2020
@tbieste tbieste added the P2 Priority 2 - Should Have label Feb 17, 2021
@tbieste tbieste added this to the Sprint 2021-03 milestone Feb 17, 2021
@tbieste tbieste self-assigned this Feb 17, 2021
@tbieste tbieste removed the P2 Priority 2 - Should Have label Feb 17, 2021
@tbieste tbieste removed this from the Sprint 2021-03 milestone Feb 17, 2021
@tbieste tbieste removed their assignment Feb 17, 2021
@tbieste tbieste added the schema-change a schema change label Mar 18, 2021
@tbieste
Copy link
Contributor

tbieste commented Mar 18, 2021

Since system + code + value must be extracted together, I don't think this can using the existing _TOKEN_VALUES_V table/view, so may require a schema change.

@lmsurpre
Copy link
Member

lmsurpre commented Mar 18, 2021

I think we should be able to get this one without a schema change. Two different ideas:

A. Since the spec requires users of of-type to always query with all 3 components, we should be able to combine the Identifier.type system+code together into one string and use that as the "system" for a token value. The one concern there is accidentally exceeding our column length limit, but I think it would be fine (if it exceeds the limit, you just can't search on that field).

B. Store the 3-tuple via an internal-only "composite parameter".
The parameter could be made of a couple components (both of type token): the first could have the system+code of the type and the second could have a default system and the identifier value as the code.

A worked example for B:
consider a Patient with an identifier that has 2 types:

Patient
Identifier
  Type 
    * mysystem|PI
    * yoursystem|ZZ
  Value 123

We'd have an internal search parameter definition like this

ibm-internal-identifier-type-composite-<paramname>
  * ibm-identifier-type (token)
  * ibm-identifier-value (token) (always going to have the default system)

after extraction we'd have entries like this in PATIENT_TOKEN_VALUES:

param_code_id system value comp_id
ibm-identifier-type mysystem PI 1
Ibm-identifier-value null 123 1
ibm-identifier-type yoursystem ZZ 2
Ibm-identifier-value null 123 2

Query comes in: Patient?identifier:of-type=mystem|PI|123

Interally re-written as: Patient?ibm-internal-identifier-type-composite-identifier=mystem|PI$123

@lmsurpre lmsurpre removed the schema-change a schema change label Mar 18, 2021
@tbieste tbieste self-assigned this Mar 19, 2021
@tbieste
Copy link
Contributor

tbieste commented Mar 19, 2021

Even though option A would be quicker, option B feels like the correct way to do this. Putting system+code into a single system field feels like a stop-gap approach. Since ':of-type' is a modifier that is unique in that it basically treats the search parameter as a composite, I think special internal handling to treat it like a composite makes sense.
This can be done in 2 stages (in different PRs even across different sprints):

  1. Extract the parameter values (as an internal composite).
  2. Update search to handle ':of-type' to search for the internal composite.

tbieste added a commit that referenced this issue Mar 19, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 19, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 19, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 19, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
@tbieste
Copy link
Contributor

tbieste commented Mar 19, 2021

All right! I think I have the :of-type search (as internal composite search) working. Thanks for the suggestion on that!
The FHIR spec says “All 3 parts must be present”, and that’s it. But I wonder if consistency with how token normally works if fewer parts are provided would be nice. Otherwise, what, throw an error?

@tbieste tbieste added this to the Sprint 2021-04 milestone Mar 19, 2021
tbieste added a commit that referenced this issue Mar 19, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
@tbieste tbieste added the reindex Resolution of issue will require a $reindex during upgrade label Mar 22, 2021
tbieste added a commit that referenced this issue Mar 22, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 22, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 22, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 22, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 22, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 22, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Mar 22, 2021
Issue #1323 - Add support for ':of-type' modifier
@prb112
Copy link
Contributor

prb112 commented Mar 23, 2021

@JohnTimm Verified

@prb112 prb112 closed this as completed Mar 23, 2021
@tbieste tbieste added the showcase Used to Identify End-of-Sprint Demos label Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reindex Resolution of issue will require a $reindex during upgrade search showcase Used to Identify End-of-Sprint Demos
Projects
None yet
Development

No branches or pull requests

4 participants