Electronic Health Records Dataset
This ready-made synthetic dataset provides a sample of electronic health records data for developers and testers. It contains 11,189 rows and 23 columns, covering patient demographics, visit details, and diagnoses. Preview rows are available for free, with full download requiring credits.
At a glance
- 3tables
- 11,189rows
- 23columns
- Jan 2010 – Jun 2024date range
The 3 tables
preview and data dictionary per tablePatients patients · table · 1,000 rows
Contains demographic and insurance information for 1,000 synthetic patients.
Preview
| patient_iduuid | first_namestring | last_namestring | date_of_birthdate | genderstring | addressstring | citystring | statestring | zip_codestring | ethnicitystring | insurance_providerstring |
|---|---|---|---|---|---|---|---|---|---|---|
| 7e3675aa-1a40-4d95-8168-e8349e87334b | David | Thompson | 2002-02-22 | Male | 123 Oak Avenue | Las Cruces | NM | 88001 | Black or African American | UnitedHealthcare |
| 3f40ade4-21df-470b-a0c2-28aadfd30b25 | Michael | Peterson | 2003-03-22 | Male | 456 Pine Street | Providence | RI | 02903 | White | BlueCross |
| 5f765331-a9b8-46bf-961c-1b6b38b0e09c | James | Taylor | 2015-12-06 | Male | 789 Maple Drive | Charleston | WV | 25301 | White | UnitedHealthcare |
| 0a037b2b-79d2-4a2b-94c2-00e7286dbfae | Robert | Perez | 2008-05-29 | Male | 101 Elm Road | Mobile | AL | 36602 | Hispanic or Latino | UnitedHealthcare |
| 9594668e-7ba4-441f-b5bb-9b069c1e7326 | William | Torres | 2020-06-05 | Male | 202 Birch Lane | Bismarck | ND | 58501 | Black or African American | Aetna |
| fe6c0677-8787-44ee-b0f9-17186b56f8b6 | Joseph | Patel | 2011-06-10 | Male | 303 Cedar Court | Fargo | ND | 58103 | White | UnitedHealthcare |
| 3bbe022f-9d5b-40ef-8d3a-2d94ec522127 | Charles | Turner | 2006-03-08 | Male | 404 Spruce Way | Anchorage | AK | 99501 | White | Aetna |
| d8e13ccd-e538-4c97-81c6-c10d95abf9c8 | Thomas | Price | 2005-02-24 | Male | 505 Walnut Street | Richmond | VA | 23218 | White | UnitedHealthcare |
| fd9abd04-426f-49a2-be78-122d3ca93c0c | Christopher | Thompson | 2009-05-09 | Male | 606 Cherry Boulevard | Detroit | MI | 48201 | Black or African American | UnitedHealthcare |
| e28b2c96-e8fa-4c97-bb70-d468e70eda58 | Daniel | Taylor | 2010-03-31 | Male | 707 Poplar Avenue | Newark | NJ | 07102 | White | Aetna |
Data dictionary
| column | type | description | example | null % |
|---|---|---|---|---|
patient_ | uuid | Primary identifier uniquely assigning each patient record.unique | 7e3675aa-1a40-4d95-8168-e8349e87334b | 0% |
first_ | string | Given first name of the patient. | David | 0% |
last_ | string | Surname or family name of the patient. | Thompson | 0% |
date_ | date | Date of birth of the patient between 2000-01-01 and 2023-12-31. | 2002-02-22 | 0% |
gender | string | Identified gender of the patient. | Male | 0% |
address | string | Residential street address of the patient. | 123 Oak Avenue | 0% |
city | string | City of residence. | Las Cruces | 0% |
state | string | Two-letter US state postal abbreviation of residence. | NM | 0% |
zip_ | string | Five-digit standard US postal ZIP code. | 88001 | 0% |
ethnicity | string | Reported race or ethnicity classification. | Black or African American | 0% |
insurance_ | string | Primary healthcare insurance provider or self-pay status. | UnitedHealthcare | 0% |
Visits visits · fact table · 8,066 rows
Records 8,066 clinical encounters, including visit type and dates.
Preview
| visit_iduuid | visit_datedate | visit_typestring | attending_physicianstring | discharge_datedate | patient_iduuid |
|---|---|---|---|---|---|
| 656d7a27-2ade-459c-b923-e2cd41fdc2fe | 2020-01-27 | Outpatient | Dr. Isabella Price | blank | 0a037b2b-79d2-4a2b-94c2-00e7286dbfae |
| 1c9649c8-e5dd-4c86-a1f1-7a779f49590d | 2014-05-15 | Outpatient | Dr. Scarlett Brooks | blank | 3bbe022f-9d5b-40ef-8d3a-2d94ec522127 |
Data dictionary
| column | type | description | example | null % |
|---|---|---|---|---|
visit_ | uuid | Unique identifier for the clinical encounter. | bf88de11-0c46-410f-83fa-1187021f5aeb | 0% |
visit_ | date | Date the patient was admitted or the clinical encounter occurred. | 2021-05-03 | 0% |
visit_ | string | Care setting/category of the clinical encounter. | Outpatient | 0% |
attending_ | string | Name and title of the lead medical doctor responsible for the patient visit. | Dr. Robert Smith | 0% |
discharge_ | date | Date the encounter concluded or the patient was formally discharged from the hospital. | 2015-07-20 | 77.6% |
patient_ | uuid | Foreign key to patients.patient_id. | 453c6cd2-cd71-430f-9c00-cdaaf0afd081 | 0% |
Diagnoses diagnoses · fact table · 2,123 rows
Details 2,123 diagnoses, including codes, descriptions, and dates.
Preview
| diagnosis_iduuid | diagnosis_codestring | diagnosis_descriptionstring | diagnosis_datedate | is_primaryboolean | visit_iduuid |
|---|---|---|---|---|---|
| b1ab5a4e-e956-4d2f-8d73-994311384bc5 | R07.9 | Chest pain, unspecified | 2017-12-26 | true | e0dc5dac-12b9-4391-a244-60828a22b397 |
| fcfe5b8b-8e4a-4117-a077-34fe0b468585 | Z00.00 | Encounter for general adult medical examination without abnormal findings | 2018-03-16 | true | 12cef987-b00e-4482-b1ef-496a9666d34b |
| d1727126-5f8f-4320-a007-87ddd9cb2fa0 | K21.9 | Gastro-esophageal reflux disease without esophagitis | 2023-03-06 | true | 6b2314b8-3a88-4c0c-bfdc-9b78208704b9 |
| a48df774-be83-4d52-adfd-bfaa0777cd74 | I10 | Essential (primary) hypertension | 2023-10-23 | true | 6ce1f395-483c-4565-b18d-95e88b1b3ad3 |
| 8853992d-03b3-4a06-a877-34c77c4eb4c3 | J06.9 | Acute upper respiratory infection, unspecified | 2017-05-26 | true | 84151169-32c3-4b93-be0d-ff2387cfca82 |
| 812593f5-59c8-4ab8-a920-462c37345264 | E11.9 | Type 2 diabetes mellitus without complications | 2015-04-17 | true | e641ec93-882a-4117-bd68-4522e69de423 |
| fa522346-d777-4abc-8c5c-c9b8840bd821 | F41.1 | Generalized anxiety disorder | 2016-01-27 | true | 0484c62f-ea64-4e3f-a22f-d7f036347a67 |
| c058f345-e811-488c-a4c4-2d1dfe91f28f | Z00.00 | Encounter for general adult medical examination without abnormal findings | 2013-11-05 | true | 23b45253-4fb3-4577-b650-4ecfa404aefc |
| d724c8f9-ac35-435e-9542-8646a60e0345 | R07.9 | Chest pain, unspecified | 2010-12-23 | true | 77f83cbf-3ae1-4107-8b0b-603286b1e704 |
| 067cb95e-4efb-42f4-b23f-438cb3094596 | F41.1 | Generalized anxiety disorder | 2013-12-31 | true | 2ae87be3-490f-429d-a60c-bfd30ff1531e |
Data dictionary
| column | type | description | example | null % |
|---|---|---|---|---|
diagnosis_ | uuid | Unique identifier for the clinical diagnosis record.unique | b1ab5a4e-e956-4d2f-8d73-994311384bc5 | 0% |
diagnosis_ | string | Standardized ICD-10-CM diagnosis code. | R07.9 | 0% |
diagnosis_ | string | Standard clinical text description matching the ICD-10 diagnosis code. | Chest pain, unspecified | 0% |
diagnosis_ | date | Date on which the diagnosis was established by the clinician. | 2017-12-26 | 0% |
is_ | boolean | Indicates whether this diagnosis represents the primary reason for the clinical visit. | true | 0% |
visit_ | uuid | Foreign key to visits.visit_id.unique | e0dc5dac-12b9-4391-a244-60828a22b397 | 0% |
How the tables join
visits.patient_id references patients.patient_idmany to one: each Visits row points to one Patients rowdiagnoses.visit_id references visits.visit_idmany to one: each Diagnoses row points to one Visits row
Questions to answer with it
List the top 5 most frequent diagnosis codes and their descriptions for patients in California.
Join patients, visits, and diagnoses tables. Filter by state='CA'. Group by diagnosis_code and diagnosis_description, count occurrences, and order by count descending.
tables: patients, visits, diagnoses
Calculate the average number of visits per patient for each gender.
Join patients and visits tables. Group by gender and count visits per patient_id, then calculate the average of these counts.
tables: patients, visits
Identify patients who had an 'Inpatient' visit and were diagnosed with a 'Pneumonia' (or similar code).
Join patients, visits, and diagnoses tables. Filter visits.visit_type = 'Inpatient' and diagnosis_code LIKE '%J18%' (or similar pneumonia codes).
tables: patients, visits, diagnoses
Create a dashboard showing the count of visits per month, broken down by visit type.
Extract month from visit_date. Group by month and visit_type, counting the number of visits.
tables: visits
Starter SQL
run against this data before publishingTable names match the SQLite file and the SQL script.
Top 13 Diagnosis Codes in California
SELECT d.diagnosis_code, d.diagnosis_description, COUNT(d.diagnosis_id) AS diagnosis_count
FROM diagnoses d
JOIN visits v ON d.visit_id = v.visit_id
JOIN patients p ON v.patient_id = p.patient_id
WHERE p.state = 'CA'
GROUP BY d.diagnosis_code, d.diagnosis_description
ORDER BY diagnosis_count DESC
LIMIT 20;Average Visits Per Patient by Gender
SELECT p.gender, AVG(visits_per_patient.visit_count) AS average_visits
FROM patients p
JOIN (
SELECT patient_id, COUNT(visit_id) AS visit_count
FROM visits
GROUP BY patient_id
) AS visits_per_patient ON p.patient_id = visits_per_patient.patient_id
GROUP BY p.gender
LIMIT 20;Monthly Visit Counts by Type
SELECT STRFTIME('%Y-%m', visit_date) AS visit_month, visit_type, COUNT(visit_id) AS visit_count
FROM visits
GROUP BY visit_month, visit_type
ORDER BY visit_month, visit_type
LIMIT 20;Load it with pandas
import pandas as pd
# Unzip the CSV download first: one file per table
patients = pd.read_csv("patients.csv")
visits = pd.read_csv("visits.csv")
diagnoses = pd.read_csv("diagnoses.csv")
# Join visits to patients
df = visits.merge(patients, left_on="patient_id", right_on="patient_id", how="left", suffixes=("", "_patients"))
print(df.groupby("gender").size().sort_values(ascending=False))Using it in your tool
- Excel
- Load each table into a separate sheet. Use Power Query to join tables based on foreign keys (e.g., patient_id, visit_id). Create a PivotTable from the joined data to analyze visit counts by month and type.
- Power BI
- Load tables into Power BI. Create relationships: patients[patient_id] -> visits[patient_id] and visits[visit_id] -> diagnoses[visit_id]. Create measures like 'Total Visits' = COUNT(visits[visit_id]) and 'Visits by Type' = CALCULATE(COUNT(visits[visit_id]), ALLEXCEPT(visits, visits[visit_type])).
- SQL
- Load the SQLite or SQL relational download. The tables are already structured with primary and foreign keys. Use JOIN clauses on patient_id and visit_id to link related data.
- Python
- Use pandas to load CSV or other formats. Join dataframes using pd.merge(). Perform aggregations and analysis using pandas functions.
Formats available
- CSV (zip)One CSV file per table, zipped
- Excel workbookOne worksheet per table
- SQLite databaseA ready-to-query database file with every table
- Parquet (zip)One Parquet file per table, zipped
- SQL scriptCREATE TABLE with primary and foreign keys, then INSERTs
- CSVA single CSV file
- JSONA single JSON file
How this data was generated
Synthetic data. Every row was generated: no real people, customers or companies are in this dataset.
Synthetic data generated by GoMask DataFactory from a relational blueprint: keys, links and rules are enforced in code, text columns are filled by a language model. No real people, companies or transactions.
- Data is synthetically generated using GoMask DataFactory.
- Patient IDs are UUIDs, ensuring unique identification.
- Diagnosis codes are based on ICD-10-CM standards.
- Checked by an automated quality gate: unique keys, no orphan foreign keys, required columns filled, declared rules and date ranges (realism score 100).
Limitations
- The dataset is synthetic and does not represent real patient data.
- Discharge dates have a high null percentage (77.57%).
- Diagnosis codes and descriptions have limited distinct values (14).
- Distributions and correlations are modelled, not measured from real records.
blueprint · electronic-health-records-dataset
Scale this dataset
Same tables. As many rows as you need.
Open the blueprint behind these 3 tables in Data Factory: keep the relationships, change a column, and generate it at the size you need.
- 50,000 rows
- 200,000 rows
- 1,000,000 rows
- Tables
- patients, visits, diagnoses
- Licence
- yours to use, including commercially
- API slug
- electronic-health-records-dataset