synthetichealth/module-builder

Complex Transition Rendering Issue

jawalonoski opened this issue · 2 comments

For example, click on the Consider_Osteoporosis state in the Injuries module and look at the complex transition. It does not render correctly in the side menu.

https://synthetichealth.github.io/module-builder/#injuries

Here is the transition:

      "complex_transition": [
        {
          "condition": {
            "condition_type": "Active Condition",
            "codes": [
              {
                "system": "SNOMED-CT",
                "code": "64859006",
                "display": "Osteoporosis (disorder)"
              }
            ]
          },
          "transition": "Diagnose_Fracture_Due_to_Osteoporosis"
        },
        {
          "condition": {
            "condition_type": "Age",
            "operator": ">",
            "quantity": 50,
            "unit": "years"
          },
          "transition": "Osteoporosis_Workup"
        },
        {
          "distributions": [
            {
              "distribution": 0.02,
              "transition": "Osteoporosis_Workup"
            },
            {
              "distribution": 0.98,
              "transition": "End_Broken_Bone_Encounter"
            }
          ],
          "remarks": [
            "Give all people a small chance to check for osteoporosis",
            "Frequent checks are not valuable -- ",
            "https://www.nih.gov/news-events/nih-research-matters/how-often-should-women-have-bone-tests"
          ]
        }
      ]

This is the first I'm looking at the complex transition editor. To be clear, is this what it is supposed to do:

  1. check if they have osteoporosis, in which case transition directly to Diagnose_Fracture_Due_to_Osteoporosis
  2. if not 1, then check to see if they are over 50, in which case go to Osteoporosis_Workup
  3. Otherwise, end the broken bone encounter for 98% of people, and for 2% do an Osteoporisis workup.

It looks like the interface assumes complex transitions are always in the form of 'meet this condition, then do this distributed transition, if not that condition then try this condition, in which you do this other distributed transition, etc'.

Fixed in #186

Now it will render complex transitions with both direct and distributed sub-transitions. It also allows you to switch back and forth between them. When you switch, it is as smart as it can be to keep the existing links. So when moving from direct to distributed, the new distributed will have one distribution of 100% going to the previous target. And when you go from distributed to direct, it will take the first distributed transition and have that be the direct transition target.

screen shot 2018-05-25 at 3 02 35 pm