The patient forgets
Between appointments she forgets how she felt and which medication she took. She hears that she “doesn’t look sick”. And she does not own her own data.
A platform that turns scattered fibromyalgia care into structured follow-up, an official document and indicators for public health. It started at a hackathon and is now in production in a municipal health network.
Fibromyalgia brings widespread pain, fatigue, poor sleep and brain fog, and it does not show up on imaging. Follow-up happens on paper, over WhatsApp and from memory. Information gets lost along the way, and three groups pay for it.
Between appointments she forgets how she felt and which medication she took. She hears that she “doesn’t look sick”. And she does not own her own data.
Reports arrive incomplete and without history. There is no way to tell whether the patient got better or worse since the last visit.
There are no indicators to plan with: the city does not know how many residents live with fibromyalgia or how they are doing.
Why now: Brazilian federal law 15.176/2025 recognises that fibromyalgia may qualify as a disability, based on a biopsychosocial assessment. That puts an obligation on cities: enrol, assess and follow up. On the city side the users are health staff, not IT people; on the patient side, people living with fatigue and brain fog. Screens had to be simple, with few steps.
The idea started as AlgiaAnalysis, which won 1st place at the 1st TechWeek. It became a Laravel API and an Angular dashboard, now in production in a municipal health network. This is what exists today.
Very few people maintain this system, and much of the code is written with AI. So the rules had to be executable: when someone (or an agent) breaks one, a test fails.
One deploy and seven modules with clear owners. A module cannot import another module’s classes: it talks through a contract, an event or a read model. An architecture test fails the build if anyone crosses the line.
More ceremony for simple things: even a permission check outside the access module has to go through the core.
The customer is a city or an inter-city consortium. Every row carries its entity, and a global scope adds the filter to every query. Leaking data between cities cannot depend on someone remembering a where.
The platform admin has no entity. That role needed its own rule, which works out the entity from the record being touched.
National ID (CPF), health card number, phones, birth date and free clinical text are encrypted. Exact CPF lookup uses an HMAC of the digits. Uploaded files are encrypted too.
There is no partial CPF search, and sorting by CPF falls back to name order. Losing the app key means losing the data, so it is backed up off the server.
Health data has a legal retention period and needs a trail. Deleting is a cascading soft delete with a preview of everything that goes with it, and the admin can restore it.
Postgres unique indexes do not skip soft-deleted rows. Re-registering a deleted CPF used to throw a 500; it now returns a clear message.
A doctor outside the network has no login. The patient shows the QR and the doctor reads the clinical summary. The token is encrypted, lasts 25 minutes and can be revoked.
Access is read-only and expires. To look again, the patient generates a new QR. Every read is logged.
None of these were business-rule bugs. Every one sat on a seam: the server, the database, the bundle or the contract between front end and API.
Run Command Timeout.LessonThe code was fine. The box lacked capacity, and the deploy had to learn to fail without taking the site down.
try/catch swallowed the error, but Postgres had already aborted the transaction (25P02), so everything after it failed.LessonIn Postgres, swallowing an exception does not save the transaction. Errors inside a transaction have to bubble up.
qrcode library is CommonJS. In the production bundle the default import arrived in a different shape than in dev.const { default: QRCode } = await import('qrcode'). Exports are tested against the production build with a real download in Playwright.LessonThe dev server hides bundle differences. Anything that produces a file gets tested on the production build.
professional_name and professional_license; the API validated doctor_name and doctor_license. Unknown keys are ignored, so nothing ever errored.LessonNo error is not proof that it worked. A front-end/API contract needs types on both sides.
Only numbers taken from the code, the test runs or the project docs. No patient data.
The main page says “1300+ tests”; the count above is from the day this case study was written.

Fibromyalgia: enrollment, a QR-coded ID card, follow-up and indicators for a municipal health network.

My life-management system, run by talking to AI. Two versions: Supabase and Laravel.

Complementary activities, extension and internship hours under the course rules, for students and faculty.