Industry examples — bRRAIn Docs
Working SDK examples for healthcare, finance, legal, manufacturing, and IoT/teleoperation.
Industry examples
Each example is a complete, runnable pattern. Clone the full project from github.com/Qosil/bRRAIn/sdk-examples.
Healthcare — patient records
Use case: find similar prior diagnoses and treatments for a new patient encounter.
ws, _ := client.Workspace("clinic-main")
encounter := map[string]any{
"type": "patient_encounter",
"patient": "person:p-1234",
"seen_at": "2026-04-16T10:12:00Z",
"chief_complaint": "chronic migraine, 3 weeks",
"vitals": map[string]any{"bp": "128/82", "hr": 72},
"meds_reviewed": []string{"ibuprofen", "sumatriptan"},
"classification": "confidential",
}
id, _ := ws.Store(encounter, sdk.WithContext(map[string]string{
"provider": "person:dr-alice",
"clinic": "org:main-clinic",
}))
similar, _ := ws.Retrieve(sdk.Query{
Search: "chronic migraine patient responded to sumatriptan",
Types: []string{"patient_encounter"},
Limit: 5,
})
The Handler's healthcare domain adapter tags PHI appropriately and respects the confidential classification at Gate 2.
Finance — transactions and compliance
Use case: log every transaction and detect anomalous patterns via the graph.
ws, _ := client.Workspace("finance-ledger")
tx := map[string]any{
"type": "transaction",
"tx_id": "tx-9012",
"amount": 24500.00,
"currency": "USD",
"from": "account:acct-1",
"to": "account:acct-99",
"purpose": "invoice settlement",
"occurred_at": "2026-04-16T12:45:00Z",
}
ws.Store(tx)
anomalies, _ := ws.Retrieve(sdk.Query{
Search: "unusual transfers above $20,000 in last 7 days",
Types: []string{"transaction"},
Filters: map[string]any{
"amount": sdk.Gte(20000),
"occurred_at": sdk.Gte(time.Now().Add(-7 * 24 * time.Hour).Format(time.RFC3339)),
},
})
Legal — precedent discovery
Use case: find similar prior cases when drafting a brief.
ws, _ := client.Workspace("litigation")
casefile := map[string]any{
"type": "case",
"caption": "Acme v. Widget Corp",
"court": "US District Court, Delaware",
"docket": "1:26-cv-00234",
"parties": []string{"org:acme", "org:widget"},
"issues": []string{"breach of contract", "damages"},
"status": "filed",
}
ws.Store(casefile)
precedents, _ := ws.Retrieve(sdk.Query{
Search: "breach of software licensing contract damages Delaware",
Types: []string{"case", "opinion"},
Limit: 10,
})
Manufacturing — supply chain lineage
Use case: trace every component back to its supplier and lot.
ws, _ := client.Workspace("factory-alpha")
part := map[string]any{
"type": "part",
"part_no": "PN-987",
"supplier": "org:supplier-a",
"lot": "lot-2026-04-15",
"received_at": "2026-04-15T08:00:00Z",
"material": "aluminum-6061",
}
ws.Store(part)
assembly := map[string]any{
"type": "assembly",
"product": "product:widget-pro",
"parts_used": []string{"part:PN-987", "part:PN-988"},
"operator": "person:bob",
"assembled_at": "2026-04-15T14:00:00Z",
}
ws.Store(assembly)
// Later, when a defect is discovered:
recalls, _ := ws.Retrieve(sdk.Query{
Filters: map[string]any{
"parts_used": sdk.Contains("part:PN-987"),
},
})
IoT / teleoperation — sensor telemetry
Use case: ingest millions of sensor readings per day and detect anomalies.
ws, _ := client.Workspace("mine-shaft-3")
svc, _ := ws.CreateSession(sdk.SessionTypeService,
sdk.WithMetadata(map[string]string{"purpose": "telemetry-ingester"}))
stream, _ := svc.StoreStream(ctx)
defer stream.Close()
for reading := range sensorNet.Readings() {
stream.Send(map[string]any{
"type": "telemetry",
"sensor": reading.SensorID,
"metric": reading.Metric,
"value": reading.Value,
"unit": reading.Unit,
"captured_at": reading.Timestamp,
})
}
// Periodically check for anomalies:
anomalies, _ := ws.Retrieve(sdk.Query{
Search: "temperature spike above threshold in zone B",
Types: []string{"telemetry"},
Filters: map[string]any{
"sensor.zone": "B",
"metric": "temperature_c",
"value": sdk.Gte(85.0),
},
})
Pair the Service session with Agent sessions for teleoperated equipment so operators' commands and the robot's actions are both captured with full provenance.
More examples
- github.com/Qosil/bRRAIn/sdk-examples — production-ready samples
- Handler adapters — for integrating existing databases and queues
- Schema design — for designing a schema optimized for your domain