Multi Organ Intervention State Space Code
A domain-specific language for clinical decision support and biotech workflow automation.
Install · Quick Start · Library · CLI · Full Manual
⚠️ RESEARCH USE ONLY
MOISSCode is a research prototype. It is NOT approved by FDA, CDSCO, or any regulatory body for clinical decision-making. Do not use MOISSCode output to make real patient care decisions. Aethryva Deeptech accepts no liability for clinical outcomes.
MOISSCode is a domain-specific language designed for medical professionals and biotech engineers. Write clinical protocols in English-like syntax and let the engine handle scoring, drug classification, billing, lab interpretation, FHIR interoperability, and more.
protocol SepsisScreen {
input: Patient p;
let score = med.scores.qsofa(p);
track p.lactate using KAE;
if score >= 2 {
administer Norepinephrine dose: 0.1 mcg/kg/min;
alert "Sepsis detected!" severity: critical;
}
assess p for sepsis;
}
Requires: Python 3.10+
git clone https://github.com/aethryva/MOISSCode.git
cd MOISSCodeWindows (PowerShell):
py -m pip install -e .macOS / Linux:
pip install -e .moiss run examples/sepsis_workup.moiss -vmoiss validate examples/sepsis_workup.moissmoiss replfrom moisscode import MOISSCodeLexer, MOISSCodeParser, MOISSCodeInterpreter, Patient
code = """
protocol QuickCheck {
input: Patient p;
let score = med.scores.qsofa(p);
if score >= 2 {
alert "High risk" severity: critical;
}
}
"""
lexer = MOISSCodeLexer()
tokens = lexer.tokenize(code)
parser = MOISSCodeParser(tokens)
program = parser.parse_program()
interp = MOISSCodeInterpreter()
interp.scope['p'] = {
'type': 'Patient',
'value': Patient(bp=85, hr=110, rr=24, temp=38.5, spo2=94,
weight=70, age=55, gcs=14, lactate=3.2, sex='M')
}
events = interp.execute(program)
for e in events:
print(e)MOISSCode ships with 20 built-in modules, all accessible via the med. prefix:
| Module | Description |
|---|---|
med.scores |
12 validated clinical scores (qSOFA, SOFA, NEWS2, MELD-Na, CHA2DS2-VASc, HEART, Framingham, Child-Pugh, CURB-65, Wells PE, Glasgow-Blatchford, KDIGO AKI) |
med.pk |
Pharmacokinetic engine (100+ drugs, dosing, interactions, TDM, renal/hepatic adjustment) |
med.lab |
Lab panels (80+ tests, 15 panels, reference ranges, eGFR via CKD-EPI 2021) |
med.micro |
Microbiology (30 organisms, MIC breakpoints, 15 empiric therapy protocols) |
med.genomics |
Pharmacogenomics (8 CYP450 genes, 20 CPIC/DPWG guidelines) |
med.biochem |
Enzyme kinetics (25 enzymes), 8 metabolic pathways |
med.epi |
Epidemiology (SIR/SEIR models, R0, herd immunity) |
med.nutrition |
Clinical nutrition (BMI, BEE, TPN, IV fluids) |
med.fhir |
FHIR R4 bridge (Patient, Bundle, MedicationRequest) |
med.db |
SQLite persistence (patients, audit trail, alerts) |
med.io |
Device management (infusion pumps, monitors, ventilators, waveforms, alarms) |
med.finance |
CPT billing (38 codes) and cost tracking |
med.research |
De-identification, consent, randomization, sample size, stratification |
med.glucose |
Diabetes management (HbA1c, CGM analytics, insulin dosing, DKA, hypoglycemia) |
med.chem |
Medicinal chemistry (40 compounds, Lipinski, BCS, ADMET, toxicity screening) |
med.signal |
Biosignal processing (ECG peaks, HRV, SpO2, rhythm classification) |
med.icd |
Medical coding (94 ICD-10-CM codes, 25 DRG groups, SNOMED CT mapping) |
med.papers |
Scientific paper generation (LaTeX/PDF in IEEE, medRxiv, bioRxiv, JAMA, Nature, Lancet, PLOS) |
med.kae |
Kalman-Autoencoder state estimator for real-time vital sign tracking |
med.moiss |
MOISS intervention timing classifier (prophylactic to too-late) |
moiss run <file.moiss> [-v] Execute a protocol
moiss validate <file.moiss> Parse-only validation
moiss repl Interactive shell
moiss version Print version
- Protocols -
protocol Name { ... } - Patient input -
input: Patient p; - Variables -
let x = expression; - Conditionals -
if condition { ... } else { ... } - Loops -
while condition { ... }andfor item in list { ... } - Custom types -
type Bacteria { name: str; mic: float; } - Functions -
function calc(a, b) { return a + b; } - Lists -
let drugs = ["A", "B", "C"]; - Alerts -
alert "message" severity: critical; - Assessments -
assess p for sepsis; - Drug admin -
administer Drug dose: 0.1 mcg/kg/min; - Tracking -
track p.lactate using KAE;
moisscode/
├── __init__.py # Public API
├── cli.py # CLI tool
├── lexer.py # Tokenizer
├── parser.py # AST parser
├── ast_nodes.py # AST definitions
├── interpreter.py # Runtime engine
├── typesystem.py # Type checking + Patient
├── stdlib.py # 20-module library
└── modules/ # Domain modules (med.*)
MOISSCode includes a REST API service for remote protocol execution.
Windows (PowerShell):
py -m pip install -e ".[api]"
py -m uvicorn moisscode.api.server:app --reloadmacOS / Linux:
pip install -e ".[api]"
uvicorn moisscode.api.server:app --reloadSee the moisscode/api/ directory for full API documentation and configuration.
If you use MOISSCode in research, please cite:
MOISS Framework:
Kunche, N. (2026). Multi-Organ Intervention State Space (MOISS): A Collision Geometry Framework for Quantifying Therapeutic Windows Across 10 Organ Systems in 301,470 ICU Patients. medRxiv. https://www.medrxiv.org/content/10.64898/2026.02.08.26345873v1
KAE Algorithm:
Kunche, N. (2025). The Kunche Adaptive Estimator: A Reliability-Adaptive Kalman Filtering Framework for Autonomous Multi-Biomarker State Estimation in Critical Care Monitoring. Authorea. https://doi.org/10.22541/au.176313985.55971071/v1
- Email: dev@aethryva.com
- Feature requests and bugs: GitHub Issues
- Creator: Nikhil Kunche
- Documentation: moisscode.com
BSL 1.1 - See LICENSE for details.