Skip to content
Partner Developer Portal

ERD

erDiagram
  mart_patient {
    VARCHAR unique_patient_id PK
    VARCHAR organisation PK
  }

  patient {
    VARCHAR unique_patient_id PK
    VARCHAR organisation PK
  }

  stg_pharmacy_patient {
    INT patient_id PK
    VARCHAR organisation PK
  }

  stg_patient_contact {
    VARCHAR unique_patient_id PK
    VARCHAR organisation PK
  }

  stg_patient_identifier {
    VARCHAR unique_patient_id PK
    VARCHAR organisation PK
  }

  stg_ethnicity {
    INT ethnicity_id PK
    VARCHAR organisation PK
  }

  patient_additional_service_type {
    VARCHAR unique_patient_id PK
  }

  patient_eps_registration_details {
    VARCHAR unique_patient_id PK
  }

  patient_imd_decile {
    INT address_id PK
    VARCHAR organisation PK
  }

  last_patient_dispensing_date {
    VARCHAR unique_patient_id PK
  }

  mart_dispensing {
    INT prescription_item_dispensed_id PK
    VARCHAR organisation PK
    VARCHAR unique_patient_id FK
  }

  active_pharmacy {
    INT pharmacy_id PK
    VARCHAR organisation PK
  }

  mart_dmr {
    INT dmr_id PK
    VARCHAR organisation PK
    VARCHAR unique_patient_id FK
  }

  stg_pharmacy_patient ||--o{ patient : source
  stg_patient_contact ||--o{ patient : contact_context
  stg_patient_identifier ||--o{ patient : identifier_context
  stg_ethnicity ||--o{ patient : ethnicity_context
  patient_additional_service_type ||--o{ patient : service_context
  patient_eps_registration_details ||--o{ patient : eps_context
  patient_imd_decile ||--o{ patient : deprivation_context
  active_pharmacy ||--o{ patient : pharmacy_context
  mart_dispensing ||--o{ last_patient_dispensing_date : activity_source
  last_patient_dispensing_date ||--o{ patient : activity_context
  patient ||--|| mart_patient : builds
  mart_patient ||--o{ mart_dmr : unique_patient_id
  mart_patient ||--o{ mart_dispensing : unique_patient_id