U6 · Secondary

NutriApp

Practice software for dietitians: patient records, meal plans, lab results and scheduling, with each practitioner's data isolated at the database level. AI reads lab reports, with mandatory review, and drafts a consult-support report.

Engineering decisions

  • Per-practitioner isolation with PostgreSQL Row Level Security across 25 clinical tables. The tenant is set only for the current transaction, so it can't leak into the next request that reuses the pooled connection.
  • Two database roles: one owns the schema, the runtime role has no superuser or BYPASSRLS. The isolation test fails if it runs with privileges that would skip RLS.
  • Append-only patient records enforced in the database: a trigger rejects updates and deletes. An account with an overdue subscription can read but not write, and the database enforces it, not the routes.
  • AI with a human in the loop: a low-confidence lab-report extraction is only saved after field-by-field review. The consult-support report never goes into the record on its own, gets only the patient's age, and is blocked without signed consent. The dietitian builds the meal plan.
  • Domain logic in TypeScript with no Next.js or React imports, running under `node --test`. A test fails on any such import, and an applied migration can't be edited (per-file checksum).
  • Clinical consultant: Dr. Cilana Carvalho.

Results

  • 25 clinical tables under RLS, with 14 test cases dedicated to isolation between practitioners.
  • Brazilian food composition table (TACO) with 597 foods and 8,100 WHO growth-curve points built in.
  • 59 SQL migrations and 53 Playwright end-to-end test cases.

Stack

Next.js 16React 19TypeScriptNode.jsPostgreSQL (RLS)OpenAI Responses APIZodStripePlaywrightDocker

What it shows

Shows I can apply AI to health data responsibly: isolation enforced by the database, mandatory human review, and clinical decisions left to the professional.