📊 Day 14 - Data Download

Hospital Patient Management - Prescription Tracking System

Download CSV files for all 4 tables with 20+ rows of messy hospital data

Healthcare Data Prescription Tracking Risk Scoring Data Cleaning

👥 Table 1: patient_records

25 rows of messy patient data with inconsistent formats, NULL values, and various date formats

patient_id full_name date_of_birth admission_date discharge_date diagnosis
P001 john smith15/05/19852024-01-10 08:30:002024-01-15Hypertension
p002SARAH JONES1990-08-2210/01/2024NULL Diabetes
P003 Mike Wilson 1978-03-102024/01/12 14:452024-01-20flu
P004anna garcia22-07-19952024-01-15NULLPNEUMONIA
p005Bob Brown1982/11/3015/01/2024 09:002024-01-18Fracture
P006EMMA DAVIS1998-02-142024-01-16 10:15:302024-01-22 Asthma
p007david lee10/09/197516/01/20242024-01-19Migraine
P008Lisa Martinez1989-07-252024/01/17 11:30NULLDEPRESSION
P009 JAMES TAYLOR 05-12-19922024-01-182024-01-25Bronchitis
p010maria lopez1980/03/1818/01/2024 14:002024-01-21arthritis
P011Robert Clark1987-11-052024-01-19 08:45:00NULLCOPD
p012NANCY WHITE15/04/199319/01/20242024-01-23 Gastritis
P013 kevin harris 1976-06-302024/01/20 09:302024-01-26Insomnia
P014Linda Martin20-08-19912024-01-21NULLANXIETY
p015PAUL THOMPSON1984/01/2221/01/2024 10:002024-01-24Allergy
P016karen walker1996-09-122024-01-22 11:15:002024-01-28 ECZEMA
p017 Mark Hall 08/11/197922/01/2024NULLSinusitis
P018SANDRA YOUNG1988-04-172024/01/23 13:452024-01-27gout
P019Daniel King12-06-19942024-01-242024-01-29GERD
p020betty wright1981/07/0824/01/2024 15:30NULL Vertigo
P021GEORGE ALLEN1977-10-252024-01-25 09:00:002024-01-30Anemia
p022 helen scott 18/02/199025/01/20242024-01-31THYROID
P023Ryan Green1986-12-032024/01/26 10:45NULL Obesity
P024MICHELLE BAKER30-05-19952024-01-272024-02-01UTI
p025steven adams1983/09/1427/01/2024 12:002024-02-02CELLULITIS

💊 Table 2: medications

5 rows of medication reference data with risk levels (Clean data)

med_id medication_name category unit_price risk_level
MED001AspirinPain Relief5.50LOW
MED002MetforminDiabetes12.00LOW
MED003LisinoprilHypertension18.50MEDIUM
MED004WarfarinBlood Thinner25.00HIGH
MED005MorphinePain Relief45.00HIGH

📋 Table 3: prescriptions

30 rows of messy prescription records with missing data and format inconsistencies

prescription_id patient_id doctor_id med_id dosage prescription_date status
RX001P001 D101 MED00310mg2024-01-10ACTIVE
RX002p002d102med002500 mg10/01/2024active
RX003P003D101MED001NULL2024/01/12Completed
RX004P004D103med999250mg15-01-2024ACTIVE
RX005NULLD102MED0055mg2024-01-16cancelled
RX006P006d103MED001100 mg16/01/2024ACTIVE
RX007p007D101med00320mg2024/01/16active
RX008P008 D104 MED002NULL17-01-2024ACTIVE
RX009P009D102MED00175mg2024-01-18Completed
RX010p010d105med0045 mg18/01/2024active
RX011P011D103MED00315mg2024/01/19ACTIVE
RX012P012D101med00150 mg19-01-2024Completed
RX013p013 D102 MED005NULL2024-01-20ACTIVE
RX014NULLD104MED0021000mg20/01/2024cancelled
RX015P015d101med00325mg2024/01/21active
RX016P016D103MED001100 mg22-01-2024ACTIVE
RX017p017D105med004NULL2024-01-22Completed
RX018P018 D101 MED002500 mg23/01/2024active
RX019P019d102med00310mg2024/01/24ACTIVE
RX020p020D104MED00510 mg24-01-2024ACTIVE
RX021P021D103med001NULL2024-01-25Completed
RX022P022d101MED00320mg25/01/2024active
RX023p023 D102 med002750 mg2024/01/26ACTIVE
RX024P024D105MED00150mg27-01-2024Completed
RX025NULLD104med004NULL2024-01-27cancelled
RX026P001d103MED00515 mg28/01/2024ACTIVE
RX027p005D101med00330mg2024/01/28active
RX028P010D102MED002500 mg29-01-2024ACTIVE
RX029P015 D104 med001NULL2024-01-30Completed
RX030p020d105MED0047.5mg30/01/2024active

👨‍⚕️ Table 4: doctors

8 rows of doctor information with messy names and statuses

doctor_id doctor_name specialization license_status hire_date
D101dr. emily chenCardiologyACTIVE2020-03-15
d102DR. MICHAEL BROWN Endocrinology active15/06/2019
D103 Sarah Davis general medicineACTIVE2021-09-01
D104james wilsonOrthopedicsSUSPENDED2018/12/10
d105LISA MARTINEZPediatricsactive01-08-2022
D106Robert Taylor Neurology ACTIVE2019-11-20
d107 KAREN MOORE Dermatologyactive10/03/2020
D108david andersonPSYCHIATRYSUSPENDED2017/05/15

📝 How to Import CSV Files

MySQL:

CREATE DATABASE hospital_db;
USE hospital_db;

-- Import patient_records
LOAD DATA LOCAL INFILE 'patient_records.csv'
INTO TABLE patient_records
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;

-- Repeat for other tables...

PostgreSQL:

CREATE DATABASE hospital_db;
\c hospital_db

-- Import patient_records
COPY patient_records FROM '/path/to/patient_records.csv'
DELIMITER ',' CSV HEADER;

-- Repeat for other tables...

Tip: Create tables with appropriate data types before importing. Use VARCHAR for IDs, DATE for dates, DECIMAL for prices.

← Back to Day 14 Challenge