erDiagram
mart_prescribing {
INT prescription_item_id PK
VARCHAR organisation PK
}
prescribing {
INT prescription_item_id PK
VARCHAR organisation PK
}
stg_prescription {
INT prescription_id PK
VARCHAR organisation PK
}
stg_prescription_item {
INT prescription_item_id PK
VARCHAR organisation PK
}
stg_prescription_status {
INT prescription_status_id PK
}
stg_prescription_type {
INT prescription_type_id PK
}
stg_prescription_item_dispensed {
INT prescription_item_dispensed_id PK
VARCHAR organisation PK
}
stg_pharmacy_patient {
INT patient_id PK
VARCHAR organisation PK
}
stg_patient_identifier {
VARCHAR unique_patient_id PK
VARCHAR organisation PK
}
active_pharmacy {
INT pharmacy_id PK
VARCHAR organisation PK
}
mart_dispensing {
INT prescription_item_dispensed_id PK
VARCHAR organisation PK
INT prescription_item_id FK
}
stg_prescription ||--o{ prescribing : source
stg_prescription_item ||--o{ prescribing : source
stg_prescription_status ||--o{ prescribing : status
stg_prescription_type ||--o{ prescribing : type
stg_prescription_item_dispensed ||--o{ prescribing : dispensing_context
stg_pharmacy_patient ||--o{ prescribing : patient_context
stg_patient_identifier ||--o{ prescribing : identifier_context
active_pharmacy ||--o{ prescribing : pharmacy_context
prescribing ||--|| mart_prescribing : builds
mart_prescribing ||--o{ mart_dispensing : prescription_item_id