medizininformatik-initiative / fhir-data-evaluator

0 stars 0 forks source link

Support counting of patient populations #4

Open juliangruendner opened 1 month ago

juliangruendner commented 1 month ago

It should be possible to not only count initial populations, but also patient populations.

when counting patient population the number of unique patient ids should be counted instead of the number of unique entries for the stratifier.

Example: If there are three resources with the code C50.0 icd10, two of which reference the same patient. and a stratifier counts the icd 10 codes.

the initial population for the sample would be 3 and the patient population would be 2

=> Patient Population = Number of Patients a stratifier exists for.

Example Measure Input:

{
  "resourceType": "Measure",
  "meta": {
    "profile": [
      "http://hl7.org/fhir/StructureDefinition/Measure"
    ]
  },
  "version": "1.0",
  "url": "https://medizininformatik-initiative.de/fhir/fdpg/Measure/ExampleConditionWithPatCount",
  "status": "active",
  "experimental": false,
  "publisher": "FDPG-Plus",
  "name": "ExampleConditionWithPatCount",
  "title": "Example Condition with Patient Count",
  "description": "Example Measure to count all ICD-10 codes and patient counts.",
  "date": "2024-06-25",
  "group": [
    {
      "description": "Simple Stratifier concept",
      "population": [
        {
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population"
              }
            ]
          },
          "criteria": {
            "language": "text/x-fhir-query",
            "expression": "Condition"
          }
        },
        {
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "measure-population"
              }
            ]
          },
          "criteria": {
            "language": "text/fhirpath",
            "expression": "Condition"
          }
        },
        {
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "measure-observation"
              }
            ]
          },
          "criteria": {
            "language": "text/fhirpath",
            "expression": "Condition.subject.reference"
          },
          "extension": [
            {
              "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-aggregateMethod",
              "valueCode": "unique-count"
            }
          ]
        }
      ],
      "stratifier": [
        {
          "criteria": {
            "language": "text/fhirpath",
            "expression": "Condition.code.coding.where(system='http://fhir.de/CodeSystem/bfarm/icd-10-gm')"
          },
          "code": {
            "coding": [
              {
                "system": "http://fhir-evaluator/strat/system",
                "code": "icd10-code"
              }
            ]
          }
        }
      ]
    }
  ]
}

Example MeasureReport Output:

juliangruendner commented 1 month ago

note that the patient ref extraction can be build analogous to flare:


 public Optional<String> patientId() {
        return patient != null ? patient.id() : subject != null ? subject.id() : Optional.ofNullable(id);
    }