Hospital v2 for developers. ER is incident response, ICU is critical production, pharmacy is hotfix repository, morgue is deprecated services.
  • JavaScript 100%
Find a file
2026-06-30 11:15:11 +00:00
node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709 test: add e2e tests 2026-06-28 11:11:19 +00:00
src feat(#1): hospital v2 engine — ER, ICU, wards, staff, patients, triage, ASCII hospital 2026-06-16 00:07:29 +00:00
tests fix: e2e tests now use CommonJS require for node --test compatibility 2026-06-30 11:15:08 +00:00
package.json feat(#1): hospital v2 engine — ER, ICU, wards, staff, patients, triage, ASCII hospital 2026-06-16 00:07:29 +00:00
README.md feat(#1): hospital v2 engine — ER, ICU, wards, staff, patients, triage, ASCII hospital 2026-06-16 00:07:29 +00:00

code-hospital-v2

Hospital v2 for developers. ER is incident response, ICU is critical production, pharmacy is hotfix repository, morgue is deprecated services.

Usage

const { Hospital, SEVERITY, STAFF_ROLES } = require('./src/hospital');

const h = new Hospital('Sacred Heart Production');
h.hireStaff('Alice', STAFF_ROLES.SURGEON);
h.hireStaff('Bob', STAFF_ROLES.NURSE);

// Admit incidents
h.admitPatient('Login page 500', SEVERITY.SERIOUS, 'er');
h.admitPatient('Memory leak in API', SEVERITY.CRITICAL, 'icu');
h.admitPatient('Typo in footer', SEVERITY.MILD, 'ward');

// Triage
const priority = h.triage();

// Treat
h.assignStaff('Alice', 2);
h.treat('Alice', 2, 'surgery');

// Time passes
for (let i = 0; i < 10; i++) h.tick();
h.advanceDay();

console.log(h.hospitalView());
console.log(h.report());

Departments

  • ER (Incident Response) — Fast triage, quick fixes
  • ICU (Critical Production) — 24/7 monitoring, barely alive
  • General Ward (Staging) — Recovering, monitored
  • Pharmacy (Hotfix Repository) — Hotfix dispensary
  • Morgue (Deprecated Services) — Rest in peace

Severity Levels

  • Mild — Minor glitch, cosmetic
  • Moderate — Feature broken, workaround exists
  • Serious — Major feature down
  • Critical — Production down, everything on fire
  • Fatal — Data loss, irreversible

Staff

  • Surgeon (SRE) — Skill 9, major incident resolver
  • Nurse (DevOps) — Skill 5, keeps everything running
  • Pharmacist (Release Engineer) — Dispenses hotfixes
  • Intern (On-Call) — First responder, pages the surgeon
  • Psychiatrist (PM) — Manages expectations, spin control