Skip to main content
Course overview

Technical specialist lab · Module 2

Know Your Clinical Data

Open the Meridan extract with pandas and interrogate it before any model is fitted: admissions versus patients, missing and implausible values, whether the label captures the intended outcome, and how the data differs by site — ending in a data-readiness judgement.

After this module you can

Open the Meridan extract with pandas and interrogate it until you can answer one question honestly: do I understand this dataset well enough to start modelling?

  • Load a clinical table with pandas and orient yourself using its shape, first rows and column types
  • Tell admissions from patients, and explain why repeated patients matter later
  • Inspect missingness, ranges, categories and implausible values before trusting them
  • Distinguish a column that is technically present from a label that is clinically trustworthy
  • Compare outcome prevalence across sites without claiming to know why it differs
  • Write a short data-readiness judgement before any model is fitted

Module 1 fixed what the model should predict, for whom and when. This module checks whether the data can support that brief. It uses pandas to read and summarise the table only: no model is fitted, nothing is imputed and no features are engineered. Model building with scikit-learn starts in Module 3, which is not yet released.

Step 1

What exactly did we receive?

The Meridan data team has delivered the extract requested in the Module 1 brief. Before any code, be clear about its provenance; then take a first look with pandas.

Where it came from

An extract from Meridan's (fictional) patient administration and laboratory systems, assembled by the data team against the Module 1 brief: adults discharged alive from non-elective stays at the North and Central sites over two years.

What it claims to contain

One row per admission, discharge-time variables only, and a readmitted_30d column built from Meridan's own admission records. A short data dictionary came with it; no documentation of how the label was derived did.

What you do not know yet

Whether the extract logic matches the brief, how complete each field is, whether both sites record things the same way, and whether the label means what Module 1 said it should. That is this module.

No Python installation is needed. Each snippet is real pandas syntax with the output it would produce on the synthetic extract; your task is to read the output, not to type the code. If you want to run the same commands yourself later, they work unchanged in any Python environment with pandas installed.

python
import pandas as pd

df = pd.read_csv("readmitai_synthetic.csv")
df.shape
output
(4218, 14)

pd.read_csv reads the file into a dataframe — a table held in memory, with named columns and numbered rows. df.shape reports its size as (rows, columns). The numbers are only as meaningful as your knowledge of what one row represents.

python
df.head()
First five rows of the synthetic extract
patient_idadmission_idsitedischarge_datetimeageprior_admissions_12mlength_of_stay_daysheart_failurecopdmedication_countcreatininehaemoglobindischarge_destinationreadmitted_30d
P-00412A-100001North2023-01-03 14:2081261011142.0108.0Home0
P-02290A-100002Central2023-01-03 16:056403017NaN131.0Home0
P-00931A-100003North2023-01-04 10:4577391114NaN97.0Care home1
P-03107A-100004Central2023-01-04 12:30581200588.0139.0Home0
P-00412A-100005North2023-01-05 09:1581341012151.0104.0Home1

df.head() shows the first five rows. Two things are already visible: patient P-00412 appears twice within three days, and creatinine shows NaN — pandas' marker for a missing value — in two rows.

python
df.dtypes
output
patient_id                object
admission_id              object
site                      object
discharge_datetime        object
age                        int64
prior_admissions_12m       int64
length_of_stay_days        int64
heart_failure              int64
copd                       int64
medication_count           int64
creatinine               float64
haemoglobin              float64
discharge_destination     object
readmitted_30d             int64
dtype: object

df.dtypes lists the type pandas inferred for each column. object usually means text; int64 whole numbers; float64 decimals. creatinine is float64 partly because pandas cannot store NaN in a plain integer column. discharge_datetime is object: read_csv did not recognise it as a date, so for now it is text and cannot yet be used to order admissions in time.

1. df.shape returned (4218, 14). 4,218 what?

2. What does the object dtype on discharge_datetime tell you?

Synthetic teaching data for the fictional Meridan Hospital. No row describes a real person, and nothing learned from it is evidence about any real health system.

Answer every item and check your work to complete this step. Getting them right is not required here — the assessment is where mastery is tested.

Lab progress

0 of 6 steps complete

Sources & evidence · 6 sources

This module cites scholarly literature, technical documentation.

Content reviewed: September 2026. Publication dates of the individual sources are shown in each citation.

  • Weiskopf NG, Weng C. Methods and dimensions of electronic health record data quality assessment: enabling reuse for clinical research. J Am Med Inform Assoc. 2013;20(1):144–151.

    Dimensions such as completeness, correctness, concordance, plausibility and currency used in this module's inspection.

    Open source
  • Kahn MG, Callahan TJ, Barnard J, et al. A harmonized data quality assessment terminology and framework for the secondary use of electronic health record data. eGEMs. 2016;4(1):1244.

    A shared vocabulary for conformance, completeness and plausibility checks.

    Open source
  • Collins GS, Moons KGM, Dhiman P, et al. TRIPOD+AI statement: updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ. 2024;385:e078378.

    Reporting items on data sources, participants, outcome definition and missing data.

    Open source
  • Moons KGM, Damen JAA, Kaul T, et al. PROBAST+AI: an updated quality, risk of bias, and applicability assessment tool for prediction models using regression or artificial intelligence methods. BMJ. 2025;388:e082505.

    Participants/data-source and outcome domains frame the questions asked here. Using it structures appraisal; it does not guarantee quality.

    Open source
  • Lekadir K, Frangi AF, Porras AR, et al. FUTURE-AI: international consensus guideline for trustworthy and deployable artificial intelligence in healthcare. BMJ. 2025;388:e081554.

    Traceability of data provenance and documentation of dataset limitations across the lifecycle.

    Open source
  • pandas user guide.

    Technical documentation for the library used in this module. Cited for library behaviour only.

    Open source