MOISS//
CODE
Clinical protocols,
as executable code.

A domain-specific language for encoding clinical and biomedical logic as executable, testable programs. A MOISS protocol takes typed patients and biomarkers as input, expresses reasoning as clinical verbs (track, assess, administer, alert), and the interpreter returns a fully auditable event trace. Underneath, twenty medical modules do the real computation: validated severity scores, compartmental pharmacokinetics, pharmacogenomics, epidemiology, and physiologic signal processing.

Get started
$pip install moisscode
EDITOR · sepsis_bundle.moiss ready
EVENT TRACE 0 events
BED 7 · ICU-07MRN 4471-08 · M / 61ySEPSIS-3--:--:--
ECG II120 / 50
108bpm
sinus tachy · R-peak
ABPsystolic
88/52
MAP 64 mmHg
SpO2 Pleth> 92
93%
PI 1.4
Resp8 / 30
24/min
impedance
Arterial blood gas · med.lab.abg_interpret
pH 7.30 · pCO₂ 32 · HCO₃ 16 · metabolic acidosis
Severity
SOFA 1 · qSOFA 3 · NEWS2 12 HIGH
Modules
20
Scores
13
Drug profiles
106
Tests
234/234
moiss run sepsis_bundle.moiss idle
§ what MOISSCode is

Clinical reasoning that a computer can check.

A spreadsheet or a Python script leaves clinical logic implicit and unverifiable. MOISSCode makes it explicit. Protocols are typed, so a dose in the wrong unit, a contraindicated drug, or a missing biomarker is caught before it runs. The interpreter is sandboxed and deterministic: the same protocol on the same inputs always yields the same event trace, so you can unit-test a guideline the way you test code. It is not an LLM wrapper and it does not guess. Every number comes from a validated formula in the standard library.

01 / WRITE

Author the protocol

Declare typed inputs (Patient, biomarkers), then express the pathway with clinical verbs: track, assess, administer, alert. Import any of 20 modules as med.*.

02 / RUN

Execute deterministically

Run locally with moiss run, embed the interpreter in Python, or call the hosted API. Dose validation and interaction geometry are enforced at execution time.

03 / READ

Audit the event trace

Every statement emits a typed event (scores, doses, alerts, interactions) that you can log, diff against a baseline, or export to FHIR R4 for the record.

§ what you can build

One language, across the clinical research stack.

Each panel below runs a real function from the standard library on real inputs. These are the workflows MOISSCode is built for, from the bedside to the bench.

med.pk · plasma_concentration TDM

Precision dosing and TDM

Pharmacometrics

Compartmental pharmacokinetics across 106 agents. Vancomycin 1 g IV q12h, 70 kg: Cmax 47.6, trough target 15 to 20 mg/L, elimination t½ 6 h. Predict troughs and adjust for renal clearance before dosing.

t = 0 minCp = 47.6 mg/Lwindow 15 to 20
med.signal · hrv_metrics RR tachogram

Physiologic signal analysis

Cardiology

R-peak detection, rhythm classification, and heart-rate variability from RR intervals. Time-domain metrics quantify autonomic tone. Reduced HRV flags increased cardiac risk.

21.0
SDNN ms
36.4
RMSSD ms
14.3%
pNN50
LOW
autonomic
med.research · sample_size power 0.80

Trial design and biostatistics

Clinical research

A-priori power analysis, block randomization, stratification, and Safe-Harbor de-identification (keyed HMAC). Two-sample test, alpha 0.05, 80% power: n scales with effect size.

effect size 0.50n / group 63total 126
med.pk · check_interactions DDI geometry

Interaction and contraindication

Safety

Every co-administered pair is graded against a curated drug-drug interaction table and escalated to the maximum severity, so a MAJOR or SEVERE pairing halts before the order stands.

med.epi · sir_model R0 3.0

Epidemic and population modelling

Public health

SIR and SEIR compartment models with reproduction number, incidence, and herd-immunity thresholds. N 100k, beta 0.3, gamma 0.1: incident cases peak at 30,165 on day 50 (attack rate 91%).

day 0infectious 10HIT 66.7%
med.genomics · translate · drug_gene_check PGx

Pharmacogenomics

Precision medicine

Transcription, translation, GC content, and CYP star-allele phenotyping. Clopidogrel maps to CYP2C19; a poor-metabolizer phenotype predicts reduced antiplatelet activation.

peptide:
GC content 61.5%Clopidogrel to CYP2C19 (substrate)
§ standard library

Twenty modules, one namespace.

Everything resolves as med.<module>.<fn>() inside a protocol or from Python. Dispatch is allowlisted, so a hostile protocol cannot reach the host filesystem or network.

01med.pkCompartmental pharmacokinetics: 106 drug profiles, dosing, plasma curves, renal and hepatic adjustment, DDI and contraindication checks.Pharmacology
02med.scores13 validated instruments: NEWS2, qSOFA, SOFA, MELD-Na, CURB-65, HEART, Wells PE, APACHE II, CHA₂DS₂-VASc, KDIGO.Bedside
03med.signalR-peak detection, HRV (SDNN, RMSSD, pNN50), rhythm classification, perfusion index, SpO₂ from ratio-of-ratios.Physiology
04med.researchPower and sample-size, randomization, stratification, Safe-Harbor de-identification, consent tracking.Biostatistics
05med.genomicsTranscription, translation, GC content, CYP star-allele phenotypes, drug-gene mapping.Genomics
06med.epiR0, SIR and SEIR models, incidence, prevalence, case-fatality, herd-immunity thresholds.Public health
07med.fhirFHIR R4 resources: Condition, MedicationRequest, to and from JSON, search URLs.Interoperability
plus chem, glucose, lab, micro, biochem, nutrition, icd, papers, finance, db, io
Research use only. MOISSCode is a research prototype. It is not approved by the FDA, CDSCO, or any regulatory body for clinical decision-making, and its output must not be used to make real patient-care decisions.
$ moiss run sepsis_bundle.moiss -v

Deterministic execution, a fully typed event trace, and a non-zero exit on any dose or interaction violation. Install and run your first protocol in under a minute.

Get started
$pip install moisscode
§ questions

What people ask.

How is this different from writing the same logic in Python?
MOISSCode is typed for the clinical domain, so a dose in the wrong unit, a contraindicated drug, or a missing biomarker fails at parse or execution time instead of becoming a silent runtime bug. Execution is deterministic and sandboxed, and every protocol is unit-testable like code. The medical math lives in a validated standard library, so you are not re-implementing NEWS2 or compartmental PK per project.
Does it use an LLM to make clinical decisions?
No. The interpreter is fully deterministic and every value comes from a published formula. The optional hosted API includes an AI code generator, but it only emits validated MOISS syntax for a human to review. It never makes a clinical decision, and moiss run itself calls no model.
Is it approved for patient care?
No. MOISSCode is a research prototype. It is not approved by the FDA, CDSCO, or any regulatory body, and its output must not be used for real patient-care decisions. It is built for research, simulation, teaching, and protocol development.
Can I run it offline or embed it in my own system?
Yes. Run pip install moisscode and execute locally with moiss run, or import the interpreter into Python. The REST API is optional. Results export to FHIR R4 (Condition, MedicationRequest) or plain JSON for your own pipeline.
Are the formulas validated, and how do I trust the output?
Each module implements formulas from the primary literature (NEWS2, SOFA, MELD-Na, compartmental pharmacokinetics, and so on), covered by 234 passing tests. Because runs are deterministic, identical inputs always produce an identical event trace, so you can pin expected output in your own test suite and diff against a baseline.
Is patient data safe when a protocol runs?
The interpreter is sandboxed with allowlisted dispatch, so a protocol cannot reach the host filesystem or network. De-identification uses a keyed HMAC under the Safe-Harbor method, and because everything can run locally, patient data never has to leave your environment.
What is the license?
BSL-1.1. Free for research and evaluation. Contact Aethryva Deeptech for production or commercial licensing terms.