Dynamic Medical
Report Builder.
A standalone PHP microservice that turns raw patient data into a printable, branded PDF report: biomarker results, old-versus-new charts and personalised health tips, called as an API by the main React app.
01 — How it worksData in.Report out.
The React app never builds PDFs itself. It sends one JSON payload to the service and gets a finished document back, so the report logic lives in one place and any app can call it.
Collects patient info, biomarker results, insights and tips.
One structured request to the service API.
Builds the report as styled HTML with the patient’s data and tips.
Draws old-versus-new comparisons for every biomarker.
Renders the page to a print-ready PDF and returns it.
02 — Input & outputWhat goes in,what comes out.
A simplified version of the contract between the app and the service, next to the kind of page it produces.
{
"patient": { "name": "Demo Patient", "age": 42 },
"biomarkers": [
{ "name": "Haemoglobin", "unit": "g/dL",
"previous": 13.1, "current": 14.2,
"status": "normal" },
{ "name": "Vitamin D", "unit": "ng/mL",
"previous": 24, "current": 18,
"status": "low" }
],
"insights": [ "Vitamin D dropped since last test" ],
"tips": [ "15 minutes of morning sun daily" ]
}14 Sep 2023
Recreated with demo data. No real patient information.
03 — The tricky partThe PDF thatwouldn’t download.
The reports looked right everywhere, but on some iPhones and some browsers, tapping “Download” simply did nothing.
Silent failure on mobile
Users on certain iPhones and browsers tapped Download and got nothing: no file, no error. Everywhere else, it worked fine.
The browser lost the click
The PDF takes a moment to generate. By the time it was ready, the browser no longer linked opening it to the user’s tap, so it treated it like a popup and blocked it.
Open on tap, fill when ready
Wrote detection for the affected devices and browsers. On those, an empty window opens the instant the user taps, then receives the PDF once it’s generated, downloads, and closes in a split second.
04 — My partWhat I built.
The service was mine from the first endpoint to the final page layout.
The microservice
Built the PHP service and the API the React app calls.
The report design
Designed the dynamic HTML/CSS template that adapts to each patient’s results.
The comparisons
Wired Chart.js into the template to show old versus new values for each biomarker.
The rendering
Made sure complex health data lands in the PDF correctly, every value, every page.
Built at Medicus AI, 2022–2023 · Visuals on this page are a recreation with demo data.