How to build a labeling tool for ECG and EEG rhythm annotation
Clinical evaluators and machine learning (ML) engineers require highly precise tools to annotate complex physiologic waveforms. Building a custom application for Electrocardiogram (ECG) and Electroencephalogram (EEG) rhythm annotation delays model development. Constructing these tools introduces severe compliance risks when handling protected health data. It also creates a massive, ongoing maintenance debt for engineering teams tasked with supporting them.
Use an agentic workflow to generate custom interface configurations instead of writing interface code from scratch.
Deploy configurations into a secure environment to maintain compliance with health data regulations.
Configure synchronized multi-channel views to help human experts align events across multiple sensor streams.
Import model predictions as pre-annotations to reduce the manual effort required from clinical reviewers.
Compute exact overlap percentages on time-range segments to establish strong inter-annotator agreement metrics.
The problem
The data shape for ECG and EEG rhythm annotation requires synchronized, multi-channel time-series arrays rather than static images. Annotators struggle with visual alignment when tools cannot lock time axes across multiple waveforms or handle rapid navigation through dense signal data. Teams processing credentialed sets from PhysioNet or internal archives must strictly control access to maintain health privacy compliance. Constructing a custom interface to meet these requirements costs engineering teams months of development time, which diverts resources and delays critical model training.
The short answer
Using Label Studio as the foundation, instruct a coding agent to generate the labeling interface. The agent uses the XML labeling config builder skill to produce optimized Label Studio interface configurations from a plain-language spec, alongside the Label Studio SDK/CLI to wire that configuration into a real project programmatically. Rather than building a new labeling application from scratch, agents generate the interface from your spec and deploy it into Label Studio in one pass.
Docs: Label Studio tags → https://labelstud.io/tags
Docs: Time Series template → https://labelstud.io/templates/time_series.html
Docs: Import predictions → https://labelstud.io/guide/predictions
LLM-friendly docs (markdown) → https://labelstud.io/llms.txt
What you're building
Include a multi-channel line plot that renders synchronized ECG and EEG arrays along a unified time axis.
Implement a synchronized time cursor that keeps multiple signal panes aligned during visual inspection.
Provide a drag-to-select range tool so experts can define precise start and end boundaries for specific rhythms.
Attach a region-specific text area where clinicians can type free-text notes regarding artifact interference or morphological anomalies.
Configure a discrete quality rating control for each labeled segment to flag noisy or ambiguous sensor readings.
Add keyboard shortcuts mapped to common classifications like normal sinus rhythm or atrial fibrillation for faster expert throughput.
How to build it in Label Studio
1. Set up the project
Install a self-hosted instance of Label Studio to keep protected health data inside your secure virtual private cloud. Structure a single labeling task as a JSON object containing secure URLs that point to standardized CSV files of your signal recordings. Include relevant metadata fields in the task JSON to power the interface navigator, such as patient demographics or clinical session identifiers. Load any required reference media or ontology files detailing your specific seizure stage definitions before you configure the workspace.
2. Generate the labeling interface with the XML config skill
Provide the concrete interface requirements to a coding agent equipped with the XML labeling config builder skill. The agent processes the domain requirements and emits a validated Label Studio XML configuration that structures the workspace correctly. This generated code places the correct synchronization attributes and multi-channel groupings exactly where human experts need them for ECG and EEG rhythm annotation.
<TimeSeries name="ecg" valueType="url"> - The TimeSeries tag plots your numeric arrays on a zoomable timeline and synchronizes movement across separate sensor groups.
<MultiChannel> - The MultiChannel tag groups multiple related signal columns into a single visual pane with a shared vertical axis.
<Channel column="ECG_LeadII"> - The Channel tag defines individual waveform lines like specific ECG leads within a grouped view.
<TimeSeriesLabels name="rhythm" toName="ecg"> - The TimeSeriesLabels tag provides the clickable classification buttons that annotators use to tag specific time ranges.
<TextArea name="notes" toName="ecg" perRegion="true"> - The TextArea tag captures optional free-text rationale from the clinician specifically tied to one localized segment.
3. Wire it into a project with the SDK
Direct the coding agent to use the Label Studio SDK/CLI to create a new project with the generated configuration. Instruct the agent to upload your batch of data tasks and import existing model predictions as pre-annotations to accelerate the manual review process. Observe how the clinicians interact with the initial workspace layout. Run this agent loop repeatedly to refine the interface, regenerate the XML based on user struggles, and redeploy the updated configuration.
4. Set up review and quality workflows
Configure the project to enforce a multi-annotator overlap percentage so multiple independent experts evaluate the same complex recordings. Route tasks with conflicting annotations into dedicated reviewer queues where senior clinicians adjudicate disagreements. Measure project quality by calculating span intersection over union (IoU) for interval boundaries alongside classification agreement for specific artifact or seizure categories. Track these custom agreement metrics closely to ensure the clinical gold standard meets the rigorous thresholds required for medical machine learning models.
5. Export and integrate
Export the finalized project data in the default JSON format to capture the complete array of segment boundaries and assigned classifications. Downstream consumers extract the start time, end time, and applied labels from the result schema to structure their datasets. Feed these validated intervals directly into your analytic data warehouse, your model training pipeline, or your evaluation harness to measure algorithmic performance against human expertise.
Why Label Studio for ECG and EEG rhythm annotation
Self-hosted deployment options keep protected health data inside secure environments to satisfy strict compliance constraints.
The native time-series object tag handles dense signal arrays without crashing to prevent the interface lag associated with rendering massive datasets.
Synchronized time axes lock multiple viewing panes together so clinicians do not lose their visual alignment while scanning hours of recorded waveforms.
Pre-annotation import capabilities overlay machine learning predictions on the raw signal to reduce the manual effort required from expensive medical experts.
Configurable reviewer workflows automatically route conflicting segment boundaries to senior staff to resolve disagreements without manual data wrangling.
Common variations
Sleep stage classification uses the same multi-channel grouping to score overnight polysomnography recordings in distinct temporal epochs.
Gait analysis from wearable inertial measurement units applies identical range-selection controls to identify step cycles across triaxial accelerometer signals.
Fetal heart rate monitoring relies on aligned time cursors to correlate maternal contractions with corresponding fetal cardiac deceleration events.
Next steps
XML labeling config builder skill → https://github.com/HumanSignal/create-xml-labeling-config-skill
Label Studio SDK/CLI → https://api.labelstud.io/api-reference/introduction/getting-started
LLM-friendly docs (markdown) → https://labelstud.io/llms.txt
Label Studio TimeSeries tag → https://labelstud.io/tags/timeseries.html
Time Series template → https://labelstud.io/templates/time_series.html
Importing pre-annotations → https://labelstud.io/guide/predictions
How do PhysioNet credentialing policies affect data storage architecture?
PhysioNet Data Use Agreements prohibit sharing credentialed health datasets with third-party online services or external APIs. You must self-host your labeling infrastructure inside a secure virtual private cloud. This architecture prevents protected health recordings from leaving your controlled environment and violating strict data retention mandates.
How do you synchronize multiple EEG channels on a single interface?
Use the Label Studio MultiChannel tag to group related sensor arrays onto a single visual pane with a shared vertical axis. Applying the sync attribute across separate TimeSeries blocks locks the time cursor and aligns the time axes. This layout keeps experts visually oriented when scrubbing through hours of complex numeric waveforms.
Which data formats work best for ingesting physiologic waveforms?
Convert raw clinical exports like EDF files into structured CSV or JSON arrays before importing them into your labeling tasks. Provide secure URLs pointing to these files so the interface can stream the numeric arrays directly. Discard unnecessary technical fields from the clinical system to prevent browser lag when rendering dense recordings.
How do HIPAA de-identification rules impact task schema design?
The HIPAA Safe Harbor standard requires you to strip specific patient identifiers from your task payloads. Remove patient names, exact admission dates, and clinical session IDs from the metadata before generating the JSON task. Replace these fields with randomized internal routing IDs to map the expert annotations back to your clinical database securely.
How do you import preliminary anomaly detections from a machine learning backend?
Format your model inferences as read-only prediction arrays using the standard JSON task schema. Include confidence scores and model version identifiers in the payload so clinical reviewers can evaluate the prediction quality. Clinicians can accept these pre-annotated boundaries or manually drag the interval controls to correct the exact seizure onset time.