FHIR R4 integration
Send a prescription as a FHIR R4 Bundle and get the risk analysis back as a FHIR
Bundle of RiskAssessment + DetectedIssue. Ideal for hospital systems (EHR/HIS) that
already speak FHIR.
Copia um prompt pronto com fluxo de integração, payload e exemplos.
Endpoint
POST /api/v1/fhir/$check (API key auth, scope interactions:check).
| Query | Default | Description |
|---|---|---|
format | fhir | fhir returns a FHIR Bundle; internal returns the native SauBit response (prescription_risk_level, clinical_alerts, …). |
Resources accepted in the Bundle
| FHIR resource | Mapped to |
|---|---|
MedicationRequest / MedicationStatement | Medication (name, dose, frequency, route). Status stopped/cancelled/entered-in-error/draft is ignored. |
Condition | Patient clinical condition. |
AllergyIntolerance | Allergy. |
Observation | Lab/context by LOINC code or text: potassium (2823-3), INR (6301-6), QTc, clearance/eGFR (33914-3), weight (29463-7), pregnancy (82810-3). |
Patient | Age (from birthDate) and sex (gender). |
Encounter | Care unit/setting (class/type) → per-unit governance (ICU/pediatrics/oncology). |
DiagnosticReport | Contained Observations → labs; conclusionCode → condition. |
Practitioner | Accepted for completeness; no effect on the deterministic analysis. |
- The drug name comes from
medicationCodeableConcept.text,coding[].display/codeormedicationReference.display. - Dose:
dosageInstruction[0].doseAndRate[0].doseQuantity(g converted to mg). - Frequency:
dosageInstruction[0].timing.repeat(e.g.frequency:1, period:8, periodUnit:"h"becomes8/8h).
Example
curl -X POST "https://api.saubit.com.br/api/v1/fhir/\$check" \
-H "X-API-Key: sm_live_..." \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType": "Bundle",
"type": "collection",
"entry": [
{ "resource": { "resourceType": "MedicationRequest", "status": "active",
"medicationCodeableConcept": { "text": "Ibuprofeno" } } },
{ "resource": { "resourceType": "MedicationRequest", "status": "active",
"medicationCodeableConcept": { "text": "Naproxeno" } } },
{ "resource": { "resourceType": "Condition", "code": { "text": "Insuficiência renal" } } }
]
}'
Response (FHIR)
{
"resourceType": "Bundle",
"type": "collection",
"total": 3,
"entry": [
{
"resource": {
"resourceType": "RiskAssessment",
"status": "final",
"method": { "text": "SauBit clinical engine" },
"prediction": [
{ "outcome": { "text": "Adverse drug event / prescription risk" },
"qualitativeRisk": { "text": "high" }, "probabilityDecimal": 0.82 }
]
}
},
{
"resource": {
"resourceType": "DetectedIssue",
"status": "preliminary",
"severity": "high",
"code": { "text": "drug_disease: NSAID may worsen renal function" },
"detail": "Avoid in this condition…",
"implicated": [ { "display": "Ibuprofeno" } ]
}
}
]
}
Severity mapping → DetectedIssue.severity: CONTRAINDICADO/GRAVE → high, MODERADO →
moderate, LEVE → low. The prescription risk becomes a RiskAssessment
(qualitativeRisk + probabilityDecimal = score/100).
Errors
Invalid bundles return a FHIR OperationOutcome with issue[].severity = "error":
{ "resourceType": "OperationOutcome",
"issue": [ { "severity": "error", "code": "invalid",
"diagnostics": "No MedicationRequest/MedicationStatement with a valid medication in the Bundle." } ] }
The analysis behind it is exactly the same as
/interactions/check— includingclinical_alerts, governance and the fail-safe policy.