TruResp 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-mode product - the approved source's own render(caseData, mode) hardcodes PCR_ONLY and no data-mode UI control exists at all. What IS real: genuine multi-page pagination (first 3 detected pathogens on page 1, additional pathogens chunked 10-per-page onto continuation pages).

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/server-api.js to match.

POST api/generate-report.php

Request body: {"case": { ... }} (a bare top-level object without the case wrapper is also accepted).

{
  "case": {
    "patient": {"name": "Sally Sample", "patientId": "RPP-260806-014", "dob": "04/12/1974", "sex": "F / Female"},
    "order": {
      "provider": "Scott M. Sweazy, MD", "specimen": "Nasopharyngeal swab", "facility": "TruPath Labs",
      "accession": "TP-RPP-260806-014", "collected": "08/06/2026  9:15 a.m.",
      "received": "08/06/2026  1:42 p.m.", "reported": "08/06/2026  4:18 p.m."
    },
    "detected": [
      {"id": "RPP01", "pcrLoad": "HIGH"},
      {"id": "RPP27", "pcrLoad": "HIGH"},
      {"id": "RPP32", "pcrLoad": "LOW"}
    ],
    "empiric": {"name": "Oseltamivir", "strength": "75 mg capsule", "directions": "Take 1 capsule by mouth twice daily for 5 days"},
    "alternatives": [{"name": "Baloxavir"}, {"name": "Doxycycline"}, {"name": "Levofloxacin"}],
    "allergies": [],
    "pregnancy": "NO",
    "pregnancyTrimester": "UNKNOWN",
    "kidneyDisease": false,
    "liverDisease": false,
    "diagnosisCodes": ["J06.9"],
    "showSampleBanner": true
  }
}

Field notes

FieldNotes
detected[]{id, pcrLoad} only - no mastLoad, no mode. pcrLoad is "HIGH" or "LOW" only (no MODERATE tier). Up to 200 entries accepted (real pagination is designed for long lists).
alternatives[]Optional, up to 3 shown. Forced to [] when detected is empty, regardless of what's submitted - mirrors the source's own readCase() literally. If omitted/empty (and detected is non-empty), the server auto-ranks by HIGH-load pathogen coverage, allergy/pregnancy filters, then support-count/score/name.
Alternative hydrationEvery alternative is hydrated from CLINICAL_PRECAUTIONS (31 drugs) - {info, renalStatus, hepaticStatus, caution, renalExclusionWhenFlagged?, hepaticExclusionWhenFlagged?}.
pregnancy / pregnancyTrimesterThree distinct behaviors: (1) influenza-antiviral→Oseltamivir substitution, any trimester; (2) doxycycline dropped unless FIRST trimester; (3) the RPP-specific delta - levofloxacin/ciprofloxacin get an unconditional pregnancy-caution note, no trimester gating, never dropped.
kidneyDisease / liverDiseaseOnly ever change an organ icon's color. Never hard-exclude a drug - organExcluded() is confirmed dead code in the approved source (defined, never called), even though 3 drugs (Nirmatrelvir-Ritonavir, Ribavirin, Trimethoprim-Sulfamethoxazole) set exclusion flags that look like they should do so.
diagnosisCodes / icd10Stored for completeness only. Confirmed fully inert - never appears in the rendered report, no codingWarning response field exists (unlike Fungal).
showSampleBannerDefault true - shows the orange "SAMPLE - NOT FOR CLINICAL USE" footer banner.

Response

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

mode is always "PCR_ONLY". pageCount reflects the real pagination: 1 page for up to 3 detected pathogens, 2 for 4-13, 3 for 14-23, and so on. renderer is "chrome" when the primary headless-Chrome-print pipeline produced the 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 respiratory targets/clinical precautions/antiviral safety/antimicrobial safety/allergy data/ICD-10 codes straight from the database - what the admin dashboard's Pathogens, Antimicrobials, Recommendations, and ICD-10 Codes pages manage. Same auth as above. No MAST-plate mapping or workflow field - this product has no reachable MAST 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-rpp/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-rpp/api/generate-report.php (and the same pattern for get-report.php / reference-data.php).

← Back to Report Generator