LinuxForHealth / FHIR

The LinuxForHealth FHIR® Server and related projects
https://linuxforhealth.github.io/FHIR
Apache License 2.0
328 stars 157 forks source link

support _text and _content common search parameter #481

Open albertwang-ibm opened 4 years ago

albertwang-ibm commented 4 years ago

This task would require large architectural changes. Currently the resource text is stored in Gzipped BLOB columns.

To use DB2 full text search I think we'd need to use CLOBS. A better option might be to store the resource text (and narrative text) in Elastic/SOLR or similar.

_content is a common search parameter for all resource types: id: Resource-content description: Search on the entire content of the resource type: string

https://www.hl7.org/fhir/searchparameter-registry.html#common

prb112 commented 4 years ago

This issue is also in our internal repo. Please make sure to close that one and mark it as migrated.

gorkemerdogann commented 4 years ago

Do you think add that parameters to this repository?

prb112 commented 4 years ago

Do you think add that parameters to this repository?

@gorkemerdogann The _text and _content parameters require a fairly complicated architecture. Could you elaborate on your use case?

gorkemerdogann commented 4 years ago

@prb112 Absolutely, they needs very complicated architecture and much more work. For an use case example: I want to search identifier or name property in patient resource with only one parameter(_text). When I pass _text parameter to server, the server can returns records which has the searched value in identifier or name field.

prb112 commented 4 years ago

@prb112 Absolutely, they needs very complicated architecture and much more work. For an use case example: I want to search identifier or name property in patient resource with only one parameter(_text). When I pass _text parameter to server, the server can returns records which has the searched value in identifier or name field.

Hi @gorkemerdogann what type of identifier and do you have an example resource? are you looking for something in natural language text or a fixed value type? we may be able to accomplish your request without a sophisticated _text or _content solution.

gorkemerdogann commented 4 years ago

Hello @prb112 thank you for your response. I'm looking fixed value type in identifier. I'm providing example resource below. I wrote <SEARCH> keywords in fields that the server has to search in example resource.

{
  "resourceType": "Patient",
  "identifier": [
    {
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
            "code": "PPN",
            "display": "Passport Number"
          }
        ],
        "text": "Passport Number"
      },
      "system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
      "value": "<SEARCH>"
    },
    {
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
            "code": "MR",
            "display": "Medical Record Number"
          }
        ],
        "text": "Medical Record Number"
      },
      "system": "http://hospital.smarthealthit.org",
      "value": "<SEARCH>"
    }
  ],
  "name": [
    {
      "use": "official",
      "family": "<SEARCH>",
      "given": [
        "<SEARCH>"
      ],
      "prefix": [
        "Mr."
      ]
    }
  ]
...
}
prb112 commented 4 years ago

While the feature does not yet exist, there may be another way to accomplish this task.

The IBM FHIR Server has a feature for Search Parameter Extensions. These extensions take FHIRPath expressions as part of the extraction routine. For example, the configuration for the my-boolean parameter is:

{
    "resourceType": "Bundle",
    "type": "collection",
    "entry": [{
        "fullUrl": "http://ibm.com/fhir/SearchParameter/Basic-boolean",
        "resource": {
            "resourceType": "SearchParameter",
            "id": "Basic-boolean",
            "url": "http://ibm.com/fhir/SearchParameter/Basic-boolean",
            "name": "my-boolean",
            "status": "active",
            "description": "test param",
            "code": "my-boolean",
            "base": ["Basic"],
            "type": "token",
            "expression": "Basic.extension.where(url='http://example.org/boolean').value",
            "xpath": "f:Basic/f:extension[@url='http://example.org/boolean']/f:valueBoolean",
            "xpathUsage": "normal"
        }
    }]
}

You may be able to add a extension-search-parameters.json with a custom FHIR Path Patient.name.given and the combine function to extract all of the search parameters.

As a user, you would be able to execute a contains search [base]/Patient?my-custom:contains=IDENTIFIER

I have not tested this approach, but it should work