Home
Ashavid
Back to Portfolio

Built by AshaVidHealthTech / Clinical TrainingRebuilt 2026

Imedica

Decision Training for Paramedics Where the Engine Scores and the Model Only Explains

A scenario-based training platform for Canadian paramedic services, built so that no individual score can be seen by an employer and no language model can change a grade.

Imedica scenario run: a call in progress with the clock running
A scenario run against the clock
3
database schemas

identity, content, analytics — no relations between them

k ≥ 5
reporting floor

nothing shown for fewer than five people

2
signatures to publish

author never publishes their own scenario

0
identifiers to the model

Claude sees decisions and rationale only

Origin

Why we started building this

In a training product for people who make life-and-death calls, the two things you cannot get wrong are who wrote the answer key and who can see the results.

Paramedics make sequenced decisions under time pressure, and the gap between knowing a protocol and applying it in the right order at the right moment is where outcomes change. Classroom training tests the knowing. Very little tests the applying.

The earlier version of Imedica had grown into a monorepo of Express, Vite and Expo. It worked, but the architecture made the two promises we cared about most — that scoring is deterministic and that no individual is identifiable — hard to prove. So we rebuilt it as one application with those promises in the data model.

The result is a platform where physicians write scenarios and the rules that grade them, paramedics run them against the clock, a pure engine scores every decision, and Claude writes the debrief — with a guard that stops it from ever claiming to change the score.

What we built

What we built

One Next.js 16 application with no separate backend: server components, server actions and a versioned REST API share a single service layer, over Prisma 7 and PostgreSQL split into three unrelated schemas for identity, content and analytics.

Decision verdict screen
Verdict on a decision
  • Deterministic rule engine

    In state X, action Y has outcome Z — correct, acceptable, suboptimal, harmful or critical — with points and an optional transition. Pure, tested, and the only thing that produces a score.

  • Two-person publishing

    Scenarios move draft → in review → published with readiness checks, and an author can never publish their own. Published scenarios lock until unpublished.

Debrief with the physicians’ rationale and AI notes
Debrief — engine score, Claude explanation
  • Three schemas, one bridge

    identity holds the only PII; content keys every run by HMAC-SHA256 of the user id; analytics receives de-identified copies. One file is allowed to cross between them.

  • Team readiness, never individual scores

    Reporting withholds any figure behind fewer than five people, so a service sees how ready its team is and nothing about one medic.

Scenario library
Scenario library
  • Pre/post assessments for pilots

    A fixed set of scenarios plus a quiz, taken before and after training, paired by anonymous hash, compared only for people who did both rounds, and checked against a 15% target.

  • AI debrief with a guard

    Claude receives the scenario, decisions and the physicians’ rationales — nothing identifying — and returns a structured explanation. A guard withholds anything resembling PII or a claim to alter the score; physicians approve or flag each one.

The Problem

Why this needed to exist

  • If a model grades a clinical decision, the grade is unexplainable and unreproducible — and no medical director will sign off on it.

  • A training record that an employer can trace to a named paramedic becomes a performance file, and people stop training honestly.

  • A physician who can publish their own scenario can publish their own mistake; clinical content needs a second pair of eyes by construction.

  • A pilot needs to show change, and showing change on five people is statistical noise dressed as a result.

  • The platform claims to run entirely in Canada, which constrains hosting, database region and every third-party call.

The Thesis

How we framed the opportunity

The opportunity was not better content. It was a system whose guarantees — about scoring and about privacy — were strong enough that a paramedic service could adopt it without a lawyer in the room.

  • Separate the score from the explanation

    The engine is the single source of a grade. The model is a writer with a brief and a guard, which keeps the product explainable and the debrief useful.

  • Put de-identification in the schema

    Three Postgres schemas with no foreign keys between them, and a secret that, if rotated, severs every link. Privacy is a structure, not a policy.

  • Clinical content needs a reviewer

    The two-person publish rule and readiness checks — one start state, an end state, every state reachable — are what make scenarios trustworthy.

  • Thresholds are honest, not generous

    k ≥ 5 everywhere, paired comparisons only, and a note about the practice effect when the same content is used twice.

The Landscape

Where the existing options fell short

What training looked like

  • Classroom sessions and multiple-choice recertification that test recall.
  • Expensive simulation labs with scarce instructor time.
  • Learning platforms where completion is tracked per employee.

What was missing

  • Sequenced, timed decision practice that a physician controls.
  • Scoring a medical director can audit line by line.
  • A privacy model that keeps individual results away from the employer.
  • A pre/post measurement a pilot can actually report.

Design Principles

The decisions that shaped the product

  1. 01

    Physicians own the answer key

    Scenarios, states, actions and rules are authored by physicians and published only under review. Engineering never decides what is clinically right.

  2. 02

    The engine grades, the model explains

    A pure, tested rule engine is the only source of a score; Claude writes the debrief under a guard that forbids PII and any claim to change the result.

  3. 03

    Services see teams, not people

    HMAC-keyed runs, de-identified analytics and a k ≥ 5 floor on every report.

The Build

How it came together

  1. Phase 1

    Rebuild on one service layer

    Collapse the Express + Vite + Expo monorepo into one Next.js app with Prisma over three unrelated Postgres schemas; archive the old code on its own branch.

  2. Phase 2

    Engine, authoring and privacy

    Ship the rule engine with unit tests, the scenario workflow with two-person publishing, the de-identification bridge, and route-level authorization tests against a real database.

  3. Phase 3

    AI debrief, assessments and the API

    Add the guarded Claude debrief with per-run cost tracking, the pre/post assessment system with paired reporting, and the versioned /api/v1 for a future mobile client.

Stack

  • Next.js 16
  • React 19
  • Prisma 7
  • PostgreSQL 16
  • Tailwind CSS 4
  • Claude (structured output)
  • Resend

Role

Product & Engineering

Audience

Paramedics · Physicians · Training Leads · Paramedic Services

What Shipped

  • A single Next.js application replacing a three-app monorepo, with the old code preserved on an archive branch
  • A pure, unit-tested rule engine producing every score; late actions at half points, critical outcomes ending the run
  • Draft → review → published scenario workflow with readiness checks and the two-person rule
  • Three Postgres schemas with no relations between them and one de-identification bridge
  • Team reporting and pre/post assessments that withhold anything under five people
  • A guarded Claude debrief with structured output, refusal fallback and physician review
  • Integration tests that exercise real route handlers: sign-in, who may author, the publish rule, run ownership and organisation scoping

Gallery

Every surface, as shipped

Pre/post assessment quiz
Pre/post assessment

What building this taught us

  1. 01

    If you cannot explain a grade line by line, do not let a model produce it.

  2. 02

    Privacy you can diagram is privacy a customer can believe.

  3. 03

    Clinical content needs a second signature; build the rule in, do not ask for it.

  4. 04

    Small numbers lie. Set the floor before the pilot, not after.

  5. 05

    A rebuild is justified when the architecture makes your promises unprovable.

We build the products we would want to operate ourselves.

Imedica is one of the ventures we design, build, and run in-house at AshaVid.