TruDerm PCR Report API

Validates a submitted case with the same database-backed clinical engine the Report Generator page uses client-side, renders the approved report design, and saves a PDF. This product line has a single report mode - no MAST/culture-plate workflow, no preliminary/pending state, and no resistance-gene concept at all.

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": "Dana Sample", "id": "DERM-260822-004", "dob": "1974-04-12", "sex": "F / Female"},
  "provider": "Scott M. Sweazy, MD",
  "specimen": "Skin scraping",
  "facility": "TruPath Labs",
  "accession": "TP-DERM-260822-004",
  "collected": "08/22/2026 8:10 a.m.",
  "received": "08/22/2026 11:35 a.m.",
  "reported": "08/22/2026 3:42 p.m.",
  "detected": [
    {"id": "saureus", "load": "HIGH"},
    {"id": "trubrum", "load": "HIGH"},
    {"id": "hsv2", "load": "MODERATE"},
    {"id": "calbicans", "load": "LOW"}
  ],
  "empiric": {"name": "Doxycycline", "strength": "100 mg", "dosing": "Take 1 tablet by mouth twice daily"},
  "allergies": ["No known drug allergies / none reported"],
  "pregnancy": "NO",
  "kidneyDisease": false,
  "liverDisease": false,
  "alternatives": ["Amoxicillin-Clavulanate", "Valacyclovir", "Terbinafine"],
  "icd10": {"selected": ["L08.9"], "other": ["", "", ""]},
  "clinicalHistory": "",
  "showSampleBanner": true
}

Field notes

FieldNotes
detected[].idMust match a pathogen's id (Pathogens dashboard page - a frozen 42-organism panel).
detected[].load"HIGH", "MODERATE", or "LOW" - every row participates in scoring regardless of load (no significance filtering).
icd10 / clinicalHistoryAccepted and stored, but have zero effect on clinical logic or the rendered report.
alternatives[]Optional, up to 3 antimicrobial names. If omitted, the server auto-ranks from the MASTER mapping (same as the page's "Rank alternatives" button), filtered for allergies/pregnancy.
pregnancy"YES", "NO", or "UNKNOWN".
kidneyDisease / liverDiseasePlain booleans (checkbox fields).
showSampleBannerDefault true - shows the orange "SAMPLE - NOT FOR CLINICAL USE" footer banner on the printed report (a PHP-port addition; the standalone generator always shows it).

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/antimicrobials/recommendations/dosing profiles/route overrides straight from the database - what the admin dashboard's Pathogens, Antimicrobials, Recommendations, and Dosing Profiles pages manage. Useful for keeping an external system's copy of the panel in sync. Same auth as above. No genes key - this product has no resistance-gene concept.

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-derm/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-derm/api/generate-report.php (and the same pattern for get-report.php / reference-data.php).

← Back to Report Generator