Aphelion (The Engine)

Generating Dummy ICD-10 and LOINC Codes for Healthcare Apps

The only synthetic data generator combining industry standards for research, clinical operations, and pharmaceutical testing

March 25, 2026 10 min read Healthcare

If you are building an Electronic Health Record (EHR) system, a telemedicine app, or a medical billing platform, you cannot test your software with generic string data.

Healthcare applications run on standardized clinical vocabularies. If your database expects an ICD-10 code for a diagnosis, or a LOINC code for a lab test, inserting a random string like "Lorem Ipsum" will immediately crash your frontend validations, break your API payloads, and ruin your database integrity.

Here is a breakdown of why generic mocking tools fail at clinical data, and how to generate valid, relational dummy healthcare codes using Algomimic’s suite of synthetic data tools.

The Code Problem: The Vocabulary Trap

To understand why custom seed scripts break healthcare apps, look at a standard clinical database schema for a patient encounter:

-- 1. The Diagnosis Table (Requires ICD-10)

CREATE TABLE patient_diagnoses (

diagnosis_id INT AUTO_INCREMENT PRIMARY KEY,

patient_id UUID NOT NULL,

icd10_code VARCHAR(10) NOT NULL, -- e.g., 'E11.9' (Type 2 Diabetes)

diagnosis_name VARCHAR(255) NOT NULL

);

-- 2. The Lab Results Table (Requires LOINC)

CREATE TABLE lab_results (

result_id INT AUTO_INCREMENT PRIMARY KEY,

patient_id UUID NOT NULL,

loinc_code VARCHAR(10) NOT NULL, -- e.g., '4548-4' (Hemoglobin A1c)

numeric_value DECIMAL(5,2),

unit VARCHAR(50)

);

Why Faker.js and Custom Scripts Fail

If you use a generic data generator to seed these tables, you will encounter two major roadblocks:

  1. Invalid Formats: Faker.js doesn't have a robust ICD-10 generator. Developers often try to hack it by generating random alphanumeric strings (e.g., X92.1A). When your application attempts to render this on the frontend or send it to a third-party billing API, the system rejects it because X92.1A is not a recognized medical code.
  2. Clinical Nonsense (The Logic Gap): Even if you write a script that picks randomly from a hardcoded array of 50 valid ICD-10 codes, the data lacks clinical sense. Your script might give a male patient an ICD-10 code for ovarian cancer, or generate a LOINC code for a cholesterol panel but assign it a numeric_value that represents a lethal blood-sugar level.

The Solution: Two Paths for Clinical Synthetic Data

Because healthcare data requires both structural validity (for developers) and clinical logic (for ML models), Algomimic provides two distinct solutions.

Path A: For App Developers (The Aphelion CLI)

If you are a backend engineer or QA lead who needs to populate a local database or staging environment with valid codes, you need Aphelion.

Aphelion is a local, Rust-native CLI that automatically introspects your database. It detects columns named icd10, loinc, or snomed, and automatically maps them to its built-in healthcare generators. It pulls from vast, valid distributions of real clinical codes without requiring you to maintain massive lookup tables in your test suite.

The Recipe for Local Clinical Seeding:
# 1. Point Aphelion at your local clinical database

aphelion introspect postgres://admin:password@localhost:5432/ehr_sandbox

# 2. Generate 5,000 valid diagnoses and lab results deterministically

aphelion generate --table patient_diagnoses --rows 5000 --seed 2026

Result: Your local database is instantly populated with valid E11.9 and J45.909 codes, accompanied by realistic diagnosis_name text, allowing you to test UI rendering and API payloads without touching real Protected Health Information (PHI).

Path B: For Enterprise ML (CausalFoundry)

If you are a Data Scientist training a predictive healthcare model, simply having valid codes isn't enough. Your ML model needs to learn the causal relationships between those codes. If the diagnosis is Diabetes (ICD-10: E11.9), the subsequent lab test must logically be an HbA1c test (LOINC: 4548-4), not a random cholesterol check.

CausalFoundry is an enterprise synthetic data factory that enforces clinical logic using a Causal Invariant Engine.

The Recipe for Clinical ML Streams:

# causal_manifest.yaml

invariants:

- clinical_correlation:

policy: deterministic

# Enforce that Lab Tests (LOINC) logically match Diagnoses (ICD-10)

constraint: "MATCH(icd10_code, allowed_loinc_array)"

state: clinical.patient_history

entropy:

- fuzz_phi:

fields: patient_name, ssn, mrn

shadow: true # Shadow your production FHIR or OMOP stream securely

Result: CausalFoundry shadows your live production EHR data, deterministically fuzzes the direct identifiers (ensuring HIPAA Safe Harbor compliance), and streams causal, mathematically valid patient journeys directly into your ML training pipelines.

Stop Hardcoding Clinical Arrays

Maintaining massive arrays of fake medical codes in your testing repositories is a waste of engineering time, and it produces brittle, unrealistic test environments.

  • Testing an API? Download the free Aphelion CLI to seed valid healthcare vocabularies locally in seconds.
  • Training an ML Model? Join the CausalFoundry Beta to stream causally accurate clinical data safely.

Tags: #Healthcare #OMOP #OpenMRS #SyntheticData #FHIR #HIPAA #DataGeneration

Ready for Verifiable Synthetic Data?

Discover how CausalFoundry manufactures high-integrity datasets that obey your complex business rules.

Explore CausalFoundry