Download backend/database/migration_pre_consultation_checklists.sql from archittmittal/Backend_PatientAppointment: direct link, hf CLI and curl.
- Browser
- Download file 3.21 kB
-
https://huggingface.co/spaces/archittmittal/Backend_PatientAppointment/resolve/main/backend/database/migration_pre_consultation_checklists.sql
- Command line
-
hf download hf://spaces/archittmittal/Backend_PatientAppointment/backend/database/migration_pre_consultation_checklists.sql
-
curl -L -o migration_pre_consultation_checklists.sql https://huggingface.co/spaces/archittmittal/Backend_PatientAppointment/resolve/main/backend/database/migration_pre_consultation_checklists.sql
3.21 kB
| -- Issue #46: Patient Prep Checklist Migration | |
| -- Stores prep items and patient completion tracking | |
| -- Custom prep items for appointments (doctor-defined) | |
| CREATE TABLE IF NOT EXISTS appointment_prep_items ( | |
| id INT PRIMARY KEY AUTO_INCREMENT, | |
| appointment_id INT NOT NULL, | |
| label VARCHAR(255) NOT NULL, | |
| priority ENUM('required', 'recommended', 'optional') DEFAULT 'recommended', | |
| icon VARCHAR(10) DEFAULT 'π', | |
| notes TEXT, | |
| display_order INT DEFAULT 99, | |
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |
| FOREIGN KEY (appointment_id) REFERENCES appointments(id) ON DELETE CASCADE, | |
| INDEX idx_appointment (appointment_id) | |
| ); | |
| -- Patient completion tracking | |
| CREATE TABLE IF NOT EXISTS patient_prep_completion ( | |
| id INT PRIMARY KEY AUTO_INCREMENT, | |
| appointment_id INT NOT NULL, | |
| patient_id INT NOT NULL, | |
| item_id VARCHAR(100) NOT NULL COMMENT 'Can be custom item ID or default item ID string', | |
| completed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |
| FOREIGN KEY (appointment_id) REFERENCES appointments(id) ON DELETE CASCADE, | |
| FOREIGN KEY (patient_id) REFERENCES patients(id) ON DELETE CASCADE, | |
| UNIQUE KEY unique_completion (appointment_id, patient_id, item_id), | |
| INDEX idx_patient_appointment (patient_id, appointment_id) | |
| ); | |
| -- Specialty prep templates (for customization) | |
| CREATE TABLE IF NOT EXISTS specialty_prep_templates ( | |
| id INT PRIMARY KEY AUTO_INCREMENT, | |
| specialty VARCHAR(100) NOT NULL, | |
| item_label VARCHAR(255) NOT NULL, | |
| priority ENUM('required', 'recommended', 'optional') DEFAULT 'recommended', | |
| icon VARCHAR(10) DEFAULT 'π', | |
| display_order INT DEFAULT 99, | |
| is_active BOOLEAN DEFAULT TRUE, | |
| created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |
| INDEX idx_specialty (specialty) | |
| ); | |
| -- Insert some default specialty templates | |
| INSERT INTO specialty_prep_templates (specialty, item_label, priority, icon, display_order) VALUES | |
| -- General | |
| ('General', 'Bring valid ID/Insurance card', 'required', 'πͺͺ', 1), | |
| ('General', 'Bring relevant medical records', 'recommended', 'π', 2), | |
| ('General', 'List of current medications', 'required', 'π', 3), | |
| ('General', 'Write down questions/concerns', 'recommended', 'β', 4), | |
| -- Cardiology | |
| ('Cardiology', 'Fast for 12 hours before blood work', 'required', 'π½οΈ', 1), | |
| ('Cardiology', 'Take blood pressure reading at home', 'recommended', 'β€οΈ', 2), | |
| ('Cardiology', 'Wear comfortable, loose clothing', 'recommended', 'π', 3), | |
| -- Lab Work | |
| ('Lab Work', 'Fast for 8-12 hours (water allowed)', 'required', 'π½οΈ', 1), | |
| ('Lab Work', 'Stay hydrated before blood draw', 'required', 'π§', 2), | |
| ('Lab Work', 'Wear short sleeves or loose top', 'recommended', 'π', 3) | |
| ON DUPLICATE KEY UPDATE item_label = VALUES(item_label); | |
| -- Prep reminder log | |
| CREATE TABLE IF NOT EXISTS prep_reminder_log ( | |
| id INT PRIMARY KEY AUTO_INCREMENT, | |
| appointment_id INT NOT NULL, | |
| patient_id INT NOT NULL, | |
| sent_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | |
| channel ENUM('app', 'email', 'sms') DEFAULT 'app', | |
| items_pending INT DEFAULT 0, | |
| FOREIGN KEY (appointment_id) REFERENCES appointments(id) ON DELETE CASCADE, | |
| INDEX idx_appointment_patient (appointment_id, patient_id) | |
| ); | |