Skip to main content
Loading navigation
Back to prompt library

Build a Clinical Interoperability Sandbox Communication Dispatch Monitor — implementation

Linked challenge: Build a Clinical Interoperability Sandbox Communication Dispatch Monitor

Prompt source

implementation87 lines11 sectionsNo variables1 code block
## Build
Track message transit latency and schema conformance for simulated FHIR care-team communication events. Detect malformed routing headers and maintain verifiable delivery audit traces.

## User
Interoperability Test Engineer

## Workflow
1. Ingest simulated FHIR R5 Communication and MessageHeader event streams via HTTP webhook.
2. Validate resource structure and sender/recipient endpoint compliance against FHIR schemas.
3. Calculate end-to-end simulated dispatch transit latencies and track dropped messages.
4. Instrument telemetry traces and generate automated conformance scorecards for integration teams.

## Interface
Real-time message traffic monitor displaying payload schema validity, transit latency gauges, and failed route alerts.

## Data
Generate synthetic FHIR R5 event streams using local Python mock scripts based on HL7 documentation.
Starter examples below are synthetic. They are not downloaded records.

## Source
[HL7 FHIR overview](https://hl7.org/fhir/overview.html)
Utilize FHIR Foundation MessageHeader and Conformance StructureDefinition rules to score inbound message syntax.

## Tools
langfuse, fastapi, pydantic.
langfuse monitors message delivery latencies, schema evaluation runs, and error rates across test suites.
Local API or hosted model for automated log classification and error narrative generation.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Validates incoming simulated FHIR message payloads against required FHIR R5 header fields.
- Computes simulated delivery duration and flags latencies exceeding pre-configured thresholds.
- Logs telemetry spans to Langfuse for each dispatch transaction.
- Exports a downloadable JSON audit scorecard detailing schema violations.

## Starter Examples
```json
[
  {
    "input": {
      "batch_id": "DISP-01",
      "messages": [
        {
          "id": "M1",
          "resourceType": "MessageHeader",
          "eventCoding": {
            "system": "http://example.org/events",
            "code": "care-team-alert"
          },
          "source": {
            "endpoint": "urn:source:lab"
          },
          "destination": [
            {
              "endpoint": "urn:dest:ward"
            }
          ]
        }
      ]
    },
    "expected_output": {
      "batch_id": "DISP-01",
      "total_processed": 1,
      "valid_headers": 1,
      "schema_errors": 0,
      "audit_status": "conforming"
    }
  },
  {
    "input": {
      "batch_id": "DISP-02",
      "messages": [
        {
          "id": "M2",
          "resourceType": "MessageHeader",
          "source": {
            "endpoint": "urn:source:lab"
          }
        }
      ]
    },
    "expected_output": {
      "batch_id": "DISP-02",
      "total_processed": 1,
      "valid_headers": 0,
      "schema_errors": 1,
      "audit_status": "non_conforming"
    }
  }
]
```

## Safety
Software testing sandbox tool; processes synthetic telemetry; no protected clinical data or real patient care delivery.
Use mock external writes. Require human review before any real deployment.