TRUFungal PCR Report API

Validates a submitted case with the same database-backed clinical engine the Report Generator page uses client-side, renders the approved 1102x1427 report design, and saves a PDF. Single report mode - no MAST/culture-plate workflow, no resistance-gene concept, no dosing-preset table.

Authentication

Every request must include one of:

Default key: DF@2026:DF@2026 (app/config/api_key.php, overridable via TRUPATH_API_KEY or api_key.local.php). If you rotate it, update the API_KEY constant in assets/generator-app.js to match.

POST api/generate-report.php

Request body: {"case": { ... }} - exactly what the Report Generator's "Download Case JSON" button produces.

{
  "patient": {"name": "Sally Sicko", "id": "FNG-260819-014", "dob": "04/12/1974", "sex": "F / Female"},
  "provider": "Scott M. Sweazy, MD",
  "specimen": "Skin / nail specimen",
  "facility": "TruPath Labs",
  "accession": "TP-FNG-260819-014",
  "collected": "08/19/2026 8:45 a.m.",
  "received": "08/19/2026 10:20 a.m.",
  "reported": "08/19/2026 1:35 p.m.",
  "detected": [
    {"id": "trichophyton_rubrum", "name": "Trichophyton rubrum"},
    {"id": "candida_albicans", "name": "Candida albicans"}
  ],
  "empiric": {"name": "Terbinafine", "strength": "250 mg", "dosing": "Take 1 tablet by mouth once daily"},
  "allergies": "No known drug allergies / none reported",
  "pregnancy": "NO",
  "kidneyDisease": false,
  "liverDisease": false,
  "alternatives": ["Itraconazole", "Micafungin", "Griseofulvin"],
  "icd10": {"selected": ["B35.1"]},
  "showSampleBanner": true
}

Field notes

FieldNotes
detected[]{id, name} only - no load field (this product's source has no HIGH/MODERATE/LOW concept). Max 3 entries.
allergiesSingle free-text string, not an array. Substring match, plus named-class shortcuts "azole"/"polyene"/"echinocandin".
empiric.strength / empiric.dosingFree text - no dosing-preset table at all.
alternatives[]Optional, up to 3 names. If omitted, ranked by coverage → rank-sum (lower better) → alphabetical, then an activity-group diversification pass avoids repeating a used drug class within a tied tier.
kidneyDisease / liverDiseaseDrive two real escalation rules: YELLOW-baseline kidney → RED (any drug); azole/terbinafine at GREEN-baseline liver → YELLOW.
icd10.selectedDrives a real codingWarning response flag: true when no selected code is "primary" tier.
showSampleBannerDefault true - shows the orange "SAMPLE - NOT FOR CLINICAL USE" footer banner.

Response

{
  "success": true,
  "message": "Report generated successfully",
  "renderer": "chrome",
  "reportId": "20260911092111_82950b59",
  "pdfUrl": "https://.../uploads/pdf/20260911092111_82950b59.pdf",
  "htmlUrl": "https://.../uploads/html/20260911092111_82950b59.html",
  "getApi": "https://.../api/get-report.php?reportId=20260911092111_82950b59"
}

renderer is "chrome" when the primary headless-Chrome-print pipeline produced the PDF (pixel-identical to the browser's own "Print / Save PDF"), or "dompdf-fallback" when Chrome wasn't available on the host. On failure: HTTP 4xx/5xx with {"success": false, "message": "..."}.

GET api/get-report.php?reportId=...

Looks up a previously generated report's PDF/HTML URLs by reportId. Same auth as above.

GET api/reference-data.php

Returns the current pathogens/ICD-10 codes/clinical (antimicrobial) data/recommendations straight from the database - what the admin dashboard's Pathogens, Antimicrobials, Recommendations, and ICD-10 Codes pages manage. Useful for keeping an external system's copy of the panel in sync. Same auth as above. No genes, dosingProfiles, or routeClinicalOverrides keys - this product has none of those concepts.

Postman collection

⇩ Download TruPath_API.postman_collection.json - includes every request above with realistic sample bodies. Import it into Postman, then check the collection variables:

VariableValueNotes
baseUrlhttps://tpl.robbiekohli.comThe bare domain only, no trailing slash and no product subfolder - every request's own path already spells out /tpl-fungal/api/..., so this same baseUrl value is shared as-is across every TruPath product on this domain.
apiKeyDF@2026:DF@2026Sent as the X-API-Key header on every request.
reportId(blank)Paste a reportId from a Generate Report response here to use with Get Report.

Full request path for this product: https://tpl.robbiekohli.com/tpl-fungal/api/generate-report.php (and the same pattern for get-report.php / reference-data.php).

← Back to Report Generator