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 for searching via canonical references #772

Closed
lmsurpre opened this issue Mar 11, 2020 · 9 comments
Closed

Support for searching via canonical references #772

lmsurpre opened this issue Mar 11, 2020 · 9 comments
Assignees
Labels
reindex Resolution of issue will require a $reindex during upgrade search showcase Used to Identify End-of-Sprint Demos

Comments

@lmsurpre
Copy link
Member

lmsurpre commented Mar 11, 2020

According to the spec, we should support searching canonical references as either a URI or a Reference.

Presently, we extract the Canonical value and store it in our X_STRING_VALUES table which serves both URI and Reference searches. However, we don't handle the |<version> part of it and we certainly don't support advanced reference stuff like chaining or includes/revincludes.

From https://www.hl7.org/fhir/search.html#versions:

Elements of type canonical may contain a version specific reference, but this version is different in both meaning and format to version specific references that might be found in a Reference:

   <valueSet value="http://hl7.org/fhir/ValueSet/example|3.0"/>
This version is a reference to the business version of the resource.

For canonical references, servers SHOULD support searching by Canonical URLs, and SHOULD support automatically detecting a |[version] portion as part of the search parameter and interpreting that portion as a search on the business version of the target resource. The modifier :below is used with canonical references, to control whether the version is considered in the search. The search:

GET {base]/Observation?definition:below=http:http://acme.com/some-profile
matches all of these element values:

http://acme.com/some-profile|1.0
http://acme.com/some-profile|1.1
http://acme.com/some-profile|2.0
The search:

GET {base]/Observation?definition:below=http:http://acme.com/some-profile|1
matches the first two element values.

And from https://www.hl7.org/fhir/search.html#uri

Note that for uri parameters that refer to the Canonical URLs of the conformance and knowledge resources (e.g. StructureDefinition, ValueSet, PlanDefinition etc), servers SHOULD support searching by canonical references, and SHOULD support automatically detecting a |[version] portion as part of the search parameter, and interpreting that portion as a search on the version.

@lmsurpre
Copy link
Member Author

lmsurpre commented Jan 19, 2021

Need to start with unit tests and figure out where we are now. If estimate seems off after that, please update it.

Note: Work we did with "common tokens" (#1366) could conflict with this.

@lmsurpre
Copy link
Member Author

A couple related HL7 JIRA issues (with corresponding discussion on chat.fhir.org):

@csandersdev
Copy link
Contributor

As a related test case, please consider the following...

I have Measure resources that refer to Library resources and I would like to retrieve both resource types in a single call as in
/Measure?_id=MEASUREIDHERE&_include=Measure:depends-on:Library. The Measure resource is defined with canonical URL references as in the snippet below.

{
  "library": [
    "http://ibm.com/fhir/wh-cohort/Library/EXM101"
  ],
}

The Library resources can themselves depend on other Library resources. Ideally, I would be able to get all the related Libraryes in a single call with _include:iterate. I see that some work was done in that area under #1158 / #2141. Would need to make sure that those features work with canonical URL references as well.

@michaelwschroeder michaelwschroeder self-assigned this Jul 7, 2021
@lmsurpre lmsurpre added this to the Sprint 2021-10 milestone Jul 12, 2021
@michaelwschroeder michaelwschroeder added the reindex Resolution of issue will require a $reindex during upgrade label Aug 9, 2021
michaelwschroeder added a commit that referenced this issue Aug 13, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 17, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 18, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 18, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 18, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 19, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 19, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 20, 2021
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
michaelwschroeder added a commit that referenced this issue Aug 20, 2021
Issue #772 - implement canonical search
@michaelwschroeder
Copy link
Contributor

Design doc attached
issue772Design_v2.docx

@csandersdev
Copy link
Contributor

@michaelwschroeder I don't see any mention of the _include:iterate case in the design doc. Will that be handled by this change or is that work for a later point?

@lmsurpre
Copy link
Member Author

@csandersdev that should be taken care of in the current implementation.

@lmsurpre lmsurpre added the showcase Used to Identify End-of-Sprint Demos label Aug 24, 2021
@lmsurpre
Copy link
Member Author

lmsurpre commented Sep 3, 2021

To QA this one, I uploaded the test resources from https://github.com/IBM/FHIR/tree/issue-2480/operation/fhir-operation-cqf/src/test/resources and ran some queries.

GET [base]/Measure?_include=Measure:depends-on:Library now returns both Measures and their dependent libraries.
GET [base]/Measure?_include=Measure:depends-on:Library&_include:iterate=Library:depends-on:Library now returns the measures, the libraries they depend on, AND the those libraries' transitive dependencies.

@lmsurpre lmsurpre closed this as completed Sep 3, 2021
@lmsurpre
Copy link
Member Author

lmsurpre commented Sep 3, 2021

I also confirmed that I can find a CodeSystems with url http://ibm.com/fhir/CodeSystem/test and version 1.0.0 via any of the following now:

However, it is my opinion that the 3rd query there is above and beyond what is needed.
I helped to open https://jira.hl7.org/browse/FHIR-33203 for this and I expect it to go away in a future version, so I've definitely recommend users to search the url and version independently (the second variant listed above).

@lmsurpre
Copy link
Member Author

lmsurpre commented Sep 3, 2021

I also ran this query which essentially looks for all the Libraries that are directly referenced by a Measure:

GET [base]/Library?_has:Measure:depends-on:status:missing=false

Interestingly, I couldn’t just do GET [base]/Library?_has:Measure:depends-on …even though I don’t care about the property of the Measure thats referencing this, just that it is referenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants