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

Search by quantity with units #308

Open
andy-a-o opened this issue Nov 30, 2020 · 0 comments
Open

Search by quantity with units #308

andy-a-o opened this issue Nov 30, 2020 · 0 comments
Labels

Comments

@andy-a-o
Copy link
Contributor

andy-a-o commented Nov 30, 2020

Describe the bug
Search by quantity with units is not working.

To Reproduce

> db.resources.find({resourceType: "Observation", "id":"80"}, {"valueQuantity":1});
{ "_id" : "Observation/80/_history/1", "valueQuantity" : { "value" : 2, "unit" : "mmol", "system" : "http://unitsofmeasure.org" } }
> db.searchindex.find({"internal_id" : "Observation/80"}, {"value-quantity":1, "internal_justid":1})
{ "_id" : ObjectId("5f9d5bde896f3f0b43f23d8b"), "internal_justid" : "80", "value-quantity" : { "system" : "http://unitsofmeasure.org", "value" : 2, "decimals" : "E00x2.0", "unit" : "" } }

GET /fhir/Observation?value-quantity=2.0||mmol

prouces this search:

{
  "find" : "searchindex",
  "filter" : {
    "internal_level" : 0,
    "internal_resource" : "Observation",
    "$or" : [
      {
        "value-quantity" : {
          "$elemMatch" : {
            "decimals" : /^E21x1.2/,
            "unit" : ""
          }
        }
      },
      {
        "value-quantity" : {
          "$not" : {
            "$type" : 4
          }
        },
        "value-quantity.decimals" : /^E21x1.2/,
        "value-quantity.unit" : ""
      }
    ]
  },
  "projection" : {
    "internal_selflink" : 1
  },
  "$db" : "spark",
  "lsid" : {
    "id" : UUID("3bcf5075-2e89-4ccd-80ea-37667866dcd3")
  }
}

and gives no results.

Expected behavior
Search with quantity and units returning the valid results.

Failed tests
SprinklerSearchTest (SE21P, SE21G, SE22P, SE22G).

Additional context
http://hl7.org/fhir/DSTU2/search.html#quantity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants