Multi Organ Intervention State Space Code — a domain-specific language for clinical decision support and biotech workflow automation.
Project description
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.
What is MOISSCode?
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;
}
Installation
Requires: Python 3.10+
git clone https://github.com/aethryva/MOISSCode.git
cd MOISSCode
Windows (PowerShell):
py -m pip install -e .
macOS / Linux:
pip install -e .
Quick Start
Run a protocol file
moiss run examples/sepsis_workup.moiss -v
Validate syntax without executing
moiss validate examples/sepsis_workup.moiss
Interactive REPL
moiss repl
Embed in Python
from 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)
Library Reference
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) |
CLI
moiss run <file.moiss> [-v] Execute a protocol
moiss validate <file.moiss> Parse-only validation
moiss repl Interactive shell
moiss version Print version
Language Features
- 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;
Project Structure
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.*)
API Server
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 --reload
macOS / Linux:
pip install -e ".[api]"
uvicorn moisscode.api.server:app --reload
See the moisscode/api/ directory for full API documentation and configuration.
Citation
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
Contact
- Email: dev@aethryva.com
- Feature requests and bugs: GitHub Issues
- Creator: Nikhil Kunche
- Documentation: moisscode.com
License
BSL 1.1 - See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moisscode-3.0.2.tar.gz.
File metadata
- Download URL: moisscode-3.0.2.tar.gz
- Upload date:
- Size: 128.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37113be5e4843b667c340e624ca492036b3a7170a7c748d28ea71591543c9486
|
|
| MD5 |
52a85c4c1cfa7d4a9c837a891bcb284c
|
|
| BLAKE2b-256 |
e0d58c1466039532e43013874211cc8882a299583121b492aacfbba3c4cd4e1b
|
File details
Details for the file moisscode-3.0.2-py3-none-any.whl.
File metadata
- Download URL: moisscode-3.0.2-py3-none-any.whl
- Upload date:
- Size: 123.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97cba6218f27913242e131ae7217e7bd7f8fda0c44b9584058ebe96eba1b2d55
|
|
| MD5 |
089424c19fd86f641a0078fa96e7fb1c
|
|
| BLAKE2b-256 |
250f0c8598a2ee7cfec6550e96e1bc261d45f7719c1da8fc78e7edbfa8b19bb1
|