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.
Metadata
Release files for moisscode 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moisscode-3.0.2.tar.gz | 128.4 kB | Without provenance | Details for moisscode-3.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moisscode-3.0.2-py3-none-any.whl | Python 3 | none | any | Details for moisscode-3.0.2-py3-none-any.whl |
Total release size: 251.6 kB
Release files / moisscode-3.0.2.tar.gz
| Download URL | moisscode-3.0.2.tar.gz |
|---|---|
| Size | 128.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37113be5e4843b667c340e624ca492036b3a7170a7c748d28ea71591543c9486
|
|
BLAKE2b-256 checksum How to use checksums |
e0d58c1466039532e43013874211cc8882a299583121b492aacfbba3c4cd4e1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / moisscode-3.0.2-py3-none-any.whl
| Download URL | moisscode-3.0.2-py3-none-any.whl |
|---|---|
| Size | 123.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97cba6218f27913242e131ae7217e7bd7f8fda0c44b9584058ebe96eba1b2d55
|
|
BLAKE2b-256 checksum How to use checksums |
250f0c8598a2ee7cfec6550e96e1bc261d45f7719c1da8fc78e7edbfa8b19bb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for moisscode 3.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.