Skip to content

Instantly share code, notes, and snippets.

@AnalogJ
Last active May 29, 2023 05:12
Show Gist options
  • Save AnalogJ/1a89e651b61e88921d24211f1cb2068f to your computer and use it in GitHub Desktop.
Save AnalogJ/1a89e651b61e88921d24211f1cb2068f to your computer and use it in GitHub Desktop.
DevDays - Answering Patient Questions using Graph Theory - Diagrams
graph LR;
  Patient --> Condition_A;
  Patient --> Condition_B;

  Condition_A --> Encounter_A;
  Encounter_A --> Location_A;
  Encounter_A --> Observation_A;
  Encounter_A --> Practitioner_A;
  Encounter_A --> DiagnosticReport_A;

  Condition_A --> Encounter_B;
  Encounter_B --> Location_B;
  Encounter_B --> Practitioner_B;
  Encounter_B --> MedicationRequest_A;
  
  
  Condition_B --> Encounter_C;
  Encounter_C --> Location_B;
  Encounter_C --> Practitioner_B;
  Encounter_B --> MedicationRequest_B;

  Location_A --> Organization_A;
  Location_B --> Organization_A;

  Condition_A[Condition A]
  Condition_B[Condition B]
  Encounter_A[Encounter A]
  Encounter_B[Encounter B]
  Encounter_C[Encounter C]
  Observation_A[Observation A]
  DiagnosticReport_A[Diagnostic Report A]
  MedicationRequest_A[Medication Request A]
  MedicationRequest_B[Medication Request B]

  Organization_A[Organization A]
  Location_A[Location A]
  Location_B[Location B]
  Practitioner_A[Practitioner A]
  Practitioner_B[Practitioner B]

Loading
graph LR;
  Patient --> Condition_A;
  Patient --> Condition_B;
  
  subgraph Condition_A_Subgraph

  Condition_A --> Encounter_A;
  Encounter_A --> Observation_A;
  Encounter_A --> DiagnosticReport_A;

  
  Condition_A --> Encounter_B;
  Encounter_B --> MedicationRequest_A;
  end
  
  subgraph Condition_B_Subgraph
  Condition_B --> Encounter_C;
  Encounter_C --> MedicationRequest_B;
  
  end
  
  
  Encounter_A --> Location_A;
  Encounter_B --> Location_B;
  Encounter_C --> Location_B;

  Encounter_A --> Practitioner_A;
  Encounter_C --> Practitioner_B;
  Encounter_B --> Practitioner_B;

  
  Location_A --> Organization_A;
  Location_B --> Organization_A;

  Condition_A(Condition A)
  Condition_B(Condition B)
  Encounter_A[Encounter A]
  Encounter_B[Encounter B]
  Encounter_C[Encounter C]
  Observation_A[Observation A]
  DiagnosticReport_A[Diagnostic Report A]
  MedicationRequest_A[Medication Request A]
  MedicationRequest_B[Medication Request B]

  Organization_A(Organization A)
  Location_A(Location A)
  Location_B(Location B)
  Practitioner_A(Practitioner A)
  Practitioner_B(Practitioner B)

  style Condition_A fill:blue,color:white,stroke:white
  style Condition_B fill:blue,color:white,stroke:white
  style Location_A fill:red,color:white,stroke:white
  style Location_B fill:red,color:white,stroke:white
  style Practitioner_A fill:red,color:white,stroke:white
  style Practitioner_B fill:red,color:white,stroke:white
  style Organization_A fill:red,color:white,stroke:white
Loading

Subgraph

graph LR;
  Patient --> Condition_A;
  Patient --> Condition_B;
  
  subgraph Condition_A_Subgraph

  Condition_A --> Encounter_A;
  Encounter_A --> Observation_A;
  Encounter_A --> DiagnosticReport_A;

  
  Condition_A --> Encounter_B;
  Encounter_B --> MedicationRequest_A;
  end
  
  
  Encounter_A --> Location_A;
  Encounter_B --> Location_B;

  Encounter_A --> Practitioner_A;
  Encounter_B --> Practitioner_B;

  
  Location_A --> Organization_A;
  Location_B --> Organization_A;

  Condition_A(Condition A)
  Condition_B(Condition B)
  Encounter_A[Encounter A]
  Encounter_B[Encounter B]
  Observation_A[Observation A]
  DiagnosticReport_A[Diagnostic Report A]
  MedicationRequest_A[Medication Request A]

  Organization_A(Organization A)
  Location_A(Location A)
  Location_B(Location B)
  Practitioner_A(Practitioner A)
  Practitioner_B(Practitioner B)

  style Condition_A fill:blue,color:white,stroke:white
  style Condition_B fill:blue,color:white,stroke:white
  style Location_A fill:red,color:white,stroke:white
  style Location_B fill:red,color:white,stroke:white
  style Practitioner_A fill:red,color:white,stroke:white
  style Practitioner_B fill:red,color:white,stroke:white
  style Organization_A fill:red,color:white,stroke:white
Loading
graph LR;
  Condition_A --> Encounter_A;
  Encounter_A --> Location_A;
  Encounter_A --> Observation_A;
  Encounter_A --> Organization_A;
  Encounter_A --> Practitioner_A;
  Encounter_A --> DiagnosticReport_A;

  Condition_A --> Encounter_B;
  Encounter_B --> Location_B;
  Encounter_B --> Practitioner_B;
  Encounter_B --> MedicationRequest_A;
  Encounter_B --> Organization_A;
  
  Organization_A --> Location_A;
  Organization_A --> Location_B;
Loading
graph LR;
  A --> B;
  Condition --> |subject|Patient
  
Loading
graph LR;
  id1(Source) --> A;
  id1(Source) --> B;

  style id1 fill:blue,color:white,stroke:white


Loading
graph LR;
  A --> id2(Sink);
  B --> id2(Sink);

  style id2 fill:red,color:white,stroke:white

Loading
graph TB;
  id1(Source) --> Procedure;
  Procedure --> Encounter --> id2;
  Procedure --> CarePlan --> id2;
  Procedure --> Patient --> id2;
  Procedure --> Practitioner --> id2;
  Procedure --> Location --> id2;
  Procedure --> Organization --> id2;
  Procedure --> Observation --> id2;
  Procedure --> Condition --> id2;
  Procedure --> DiagnosticReport --> id2;
  Procedure --> ... --> id2;
  id2(Sink)

  linkStyle 0 stroke-width:2px,fill:none,stroke:blue;
  linkStyle 2 stroke-width:2px,fill:none,stroke:red;
  linkStyle 4 stroke-width:2px,fill:none,stroke:red;
  linkStyle 6 stroke-width:2px,fill:none,stroke:red;
  linkStyle 8 stroke-width:2px,fill:none,stroke:red;
  linkStyle 10 stroke-width:2px,fill:none,stroke:red;
  linkStyle 12 stroke-width:2px,fill:none,stroke:red;
  linkStyle 14 stroke-width:2px,fill:none,stroke:red;
  linkStyle 16 stroke-width:2px,fill:none,stroke:red;
  linkStyle 18 stroke-width:2px,fill:none,stroke:red;
  linkStyle 20 stroke-width:2px,fill:none,stroke:red;
  style id1 fill:blue,color:white,stroke:white
  style id2 fill:red,color:white,stroke:white

Loading
graph LR;
  A --- B;
  A --- E;
  A --- D;
  B --- C;
  D --- E;
  E --- F;
  E --- C;
  
Loading
graph LR;
  A --> B;
  A --> E;
  A --> D;
  B --> C;
  D --> E;
  E --> F;
  E --> C;
  
Loading
graph LR;
  A --> B;
  A --> E;
  A --> D;
  B --> C;
  D --> E;
  E --> F;
  E --> C;
  
  style A fill:blue,color:white,stroke:white
  style C fill:red,color:white,stroke:white
  style F fill:red,color:white,stroke:white

Loading

Medical History

graph LR;
  Condition
  Encounter
  ExplanationOfBenefits
  
  Location
  Binary
  Device
  Organization
  Practitioner
  Medication
  Patient
  
  style Condition fill:blue,color:white,stroke:white
  style Encounter fill:blue,color:white,stroke:white
  style ExplanationOfBenefits fill:blue,color:white,stroke:white

  style Location fill:red,color:white,stroke:white
  style Binary fill:red,color:white,stroke:white
  style Device fill:red,color:white,stroke:white
  style Organization fill:red,color:white,stroke:white
  style Practitioner fill:red,color:white,stroke:white
  style Medication fill:red,color:white,stroke:white
  style Patient fill:red,color:white,stroke:white
Loading

Medication History

graph LR;
  Medication
  MedicationRequest
  MedicationDispense
  MedicationAdministration
  MedicationStatement
  
  Condition
  Encounter
  ExplanationOfBenefits
  Patient
  Location
  Binary
  Device
  Organization
  Practitioner
    
  style Medication fill:blue,color:white,stroke:white
  style MedicationRequest fill:blue,color:white,stroke:white
  style MedicationDispense fill:blue,color:white,stroke:white
  style MedicationAdministration fill:blue,color:white,stroke:white
  style MedicationStatement fill:blue,color:white,stroke:white


  style Condition fill:red,color:white,stroke:white
  style Encounter fill:red,color:white,stroke:white
  style ExplanationOfBenefits fill:red,color:white,stroke:white
  style Location fill:red,color:white,stroke:white
  style Binary fill:red,color:white,stroke:white
  style Device fill:red,color:white,stroke:white
  style Organization fill:red,color:white,stroke:white
  style Practitioner fill:red,color:white,stroke:white
  style Patient fill:red,color:white,stroke:white
Loading

AddressBook

graph LR;
  Practitioner
  Organization
  PractitionerRole
  CareTeam
  Location
  
  Condition
  Encounter
  ExplanationOfBenefits
  Patient
  Medication
  Device
    
  style Practitioner fill:blue,color:white,stroke:white
  style Organization fill:blue,color:white,stroke:white
  style PractitionerRole fill:blue,color:white,stroke:white
  style CareTeam fill:blue,color:white,stroke:white
  style Location fill:blue,color:white,stroke:white


  style Condition fill:red,color:white,stroke:white
  style Encounter fill:red,color:white,stroke:white
  style ExplanationOfBenefits fill:red,color:white,stroke:white
  style Patient fill:red,color:white,stroke:white
  style Medication fill:red,color:white,stroke:white
  style Device fill:red,color:white,stroke:white
Loading

Immunizations

graph LR;
  Immunization
  
  All[All Resources]
    
  style Immunization fill:blue,color:white,stroke:white



  style All fill:red,color:white,stroke:white

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment