synthetichealth/synthea

Generate only patients that went through a specific Encounter or Procedure

Opened this issue · 1 comments

Requested Feature

Hello. We need to generate only patients that had a surgery - ideally insertion of a pacemaker. (Or if not possible with the pacemaker, then at least any surgery).
So, for example, I have found this module

and would like to generate the patients that went through the "Surgical encounter". Or from the same module, I would like to filter out patients that went through Procedure "LVAD insertion" .

I guess I need to use Keep module feature, but I cannot figure it out how to structure the JSON file in a way that it does what I want.

How can I achieve such a filtering?
Is there a module for the pacemaker insertion?

This isn't documented anywhere but because of how the health record entries are modeled in Synthea, you can also use the "Active Condition" logic to also represent "Procedure Performed". You might want something like this for your keep module:

{
  "name": "Generated Keep Module",
  "states": {
    "Initial": {
      "type": "Initial",
      "name": "Initial",
      "conditional_transition": [
        {
          "transition": "Keep",
          "condition": {
            "condition_type": "And",
            "conditions": [
              {
                "condition_type": "Active Condition",
                "codes": [
                  {
                    "system": "SNOMED-CT",
                    "code": "232967006",
                    "display": "Implantation of left ventricular assist device (procedure)"
                  }
                ]
              }
            ]
          }
        },
        {
          "transition": "Terminal"
        }
      ]
    },
    "Terminal": {
      "type": "Terminal",
      "name": "Terminal"
    },
    "Keep": {
      "type": "Terminal",
      "name": "Keep"
    }
  },
  "gmf_version": 2
}

(created using the customizer at https://synthetichealth.github.io/spt/#/customizer )