Skip to main content

3.2.9 PatRx

The PatRx table in Supabase stores all prescriptions for each patient case. Each medication is linked to a patient via pat_id and receives a unique rx_id. The table supports storage of up to three medications, with metadata including the medication name, Pharmazentralnummer (PZN), the medication regimen and an internal rx_key.

Table Structure

ColumnFormatTypeDescription
pat_idbigintnumberInternal ID of the patient receiving the prescription (as in PatBase)
rx_idbigintnumberUnique prescription ID
data-0jsonbjsonMetadata for medication 1 (e.g., ppn, name, regime, rx_key)
data-1jsonbjsonMetadata for medication 2 (e.g., ppn, name, regime, rx_key)
data-2jsonbjsonMetadata for medication 3 (e.g., ppn, name, regime, rx_key)
rx_key-0textstringInternal medication key for medication 1
rx_key-1textstringInternal medication key for medication 2
rx_key-2textstringInternal medication key for medication 3

Example medication metadata:

{
"ppn": "{"17976544,
"name": "Paracetamol 500 mg (Tabl)",
"regime": "1-0-0",
"rx_key": "6718342"
}

Integration within the System

Medications are added to the PatRx table using the addRx function in logic_server.js. Medication metadata includes ppn and rx_key, which are matched to ppn and id in the ref_rx table in Supabase. Each prescription is linked to the correct patient case via pat_id.