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

Unexpected during evaluation #274

Open
brynrhodes opened this issue Mar 23, 2023 · 0 comments
Open

Unexpected during evaluation #274

brynrhodes opened this issue Mar 23, 2023 · 0 comments

Comments

@brynrhodes
Copy link
Member

Given the following library:

library Queries

using QICore version '4.1.1'

include FHIRHelpers version '4.1.000'

parameter "Measurement Period" Interval<DateTime> default Interval[@2023-01-01T00:00:00.0Z, @2023-12-31T23:59:59.999Z]

context Patient

define "Blood Pressure Observations":
  ["Observation Blood Pressure Profile"]

define "Encounters With Blood Pressure":
  [Encounter] E
    with ["Observation Blood Pressure Profile"] O
      such that O.effective during E.period

define "Encounter-1 Period":
  singleton from (
    [Encounter] E
        where E.id = 'Encounter-1'
        return E.period
  )

define "Observation Blood Pressure Effective":
  singleton from (
    ["Observation Blood Pressure Profile"] O
      return O.effective
  )

define "Is During":
  "Observation Blood Pressure Effective" during "Encounter-1 Period"

define "On Or After Start Of":
  "Observation Blood Pressure Effective" on or after start "Encounter-1 Period"

define "On Or Before End Of":
  "Observation Blood Pressure Effective" on or before end "Encounter-1 Period"

And the following Encounter and Observation resources:

{
    "resourceType": "Encounter",
    "id": "Encounter-1",
    "meta": {
        "profile": [
          "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"
        ]
    },
    "subject": {
      "reference": "Patient/example"
    },
    "status": "finished",
    "class": {
      "code": "AMB",
      "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
      "display": "ambulatory"
    },
    "type": [
      {
        "coding": [
          {
            "code": "3391000175108",
            "system": "http://snomed.info/sct",
            "display": "Office visit for pediatric care and assessment (procedure)"
          }
        ]
      }
    ],
    "period": {
      "start": "2023-01-10T10:00:00.000Z",
      "end": "2023-01-10T11:00:00.000Z"
    }
  }
{
  "resourceType": "Observation",
  "id": "blood-pressure",
  "meta": {
    "profile": [
      "http://hl7.org/fhir/StructureDefinition/bp"
    ]
  },
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: blood-pressure</p><p><b>meta</b>: </p><p><b>status</b>: final</p><p><b>category</b>: Vital Signs <span style=\"background: LightGoldenRodYellow\">(Details : {http://terminology.hl7.org/CodeSystem/observation-category code 'vital-signs' = 'Vital Signs', given as 'Vital Signs'})</span></p><p><b>code</b>: Blood pressure systolic and diastolic <span style=\"background: LightGoldenRodYellow\">(Details : {LOINC code '85354-9' = 'Blood pressure panel with all children optional', given as 'Blood pressure panel with all children optional'})</span></p><p><b>subject</b>: <a href=\"Patient-example.html\">Amy Shaw. Generated Summary: id: example; Medical Record Number = 1032702 (USUAL); active; Amy V. Shaw ; ph: 555-555-5555(HOME), amy.shaw@example.com; gender: female; birthDate: 2007-02-20</a></p><p><b>encounter</b>: GP Visit</p><p><b>effective</b>: 02/07/1999 12:00:00 AM</p><blockquote><p><b>component</b></p><p><b>code</b>: Systolic blood pressure <span style=\"background: LightGoldenRodYellow\">(Details : {LOINC code '8480-6' = 'Systolic blood pressure', given as 'Systolic blood pressure'})</span></p><p><b>value</b>: 109 mmHg<span style=\"background: LightGoldenRodYellow\"> (Details: UCUM code mm[Hg] = 'mm[Hg]')</span></p></blockquote><blockquote><p><b>component</b></p><p><b>code</b>: Diastolic blood pressure <span style=\"background: LightGoldenRodYellow\">(Details : {LOINC code '8462-4' = 'Diastolic blood pressure', given as 'Diastolic blood pressure'})</span></p><p><b>value</b>: 44 mmHg<span style=\"background: LightGoldenRodYellow\"> (Details: UCUM code mm[Hg] = 'mm[Hg]')</span></p></blockquote></div>"
  },
  "status": "final",
  "category": [
    {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/observation-category",
          "code": "vital-signs",
          "display": "Vital Signs"
        }
      ],
      "text": "Vital Signs"
    }
  ],
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "85354-9",
        "display": "Blood pressure panel with all children optional"
      }
    ],
    "text": "Blood pressure systolic and diastolic"
  },
  "subject": {
    "reference": "Patient/example",
    "display": "Amy Shaw"
  },
  "encounter": {
    "display": "GP Visit"
  },
  "effectiveDateTime": "2023-01-10T10:10Z",
  "component": [
    {
      "code": {
        "coding": [
          {
            "system": "http://loinc.org",
            "code": "8480-6",
            "display": "Systolic blood pressure"
          }
        ],
        "text": "Systolic blood pressure"
      },
      "valueQuantity": {
        "value": 109,
        "unit": "mmHg",
        "system": "http://unitsofmeasure.org",
        "code": "mm[Hg]"
      }
    },
    {
      "code": {
        "coding": [
          {
            "system": "http://loinc.org",
            "code": "8462-4",
            "display": "Diastolic blood pressure"
          }
        ],
        "text": "Diastolic blood pressure"
      },
      "valueQuantity": {
        "value": 44,
        "unit": "mmHg",
        "system": "http://unitsofmeasure.org",
        "code": "mm[Hg]"
      }
    }
  ]
}

The result of the "Is During" expression should be true, but is returning null

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

No branches or pull requests

1 participant