# hl7v2-server
HTTP/gRPC runtime service for HL7 v2 validation and evidence workflows.
`hl7v2-server` is the deployable sidecar/edge-guard crate in the
[`hl7v2-rs`](https://github.com/EffortlessMetrics/hl7v2-rs) workspace. It is
separate from the `hl7v2` library crate because it carries runtime concerns:
HTTP/gRPC serving, metrics, authentication, rate limits, config loading, and
filesystem output roots.
## Sidecar workflows
Useful release-candidate workflows include:
- `hl7v2-server --print-config` for sanitized effective configuration output.
- `GET /ready` for startup readiness checks.
- `POST /hl7/validate` for typed validation reports.
- `POST /hl7/validate-redacted` for validate-and-redact workflows.
- `POST /hl7/bundle` for server-created redacted evidence bundles under a
configured bundle output root.
- `POST /hl7/ack-policy` for policy-driven ACK/NAK decisions.
- `/metrics` for Prometheus metrics.
The server reuses the same evidence contracts as the CLI and `hl7v2` library
instead of defining a server-only report language.
## Usage
Inspect effective configuration without leaking secrets:
```bash
hl7v2-server --print-config
```
Run readiness after startup:
```bash
curl http://127.0.0.1:8080/ready
```
Create a redacted validation report:
```bash
curl -X POST http://127.0.0.1:8080/hl7/validate-redacted \
-H "Content-Type: application/json" \
-d '{
"message": "MSH|^~\\&|App||Fac||20250128||ADT^A01|123|P|2.5.1\rPID|1||MRN123||Doe^John\r",
"profile": "name: ADT_A01\nmessage_type: ADT^A01\nsegments: []\n",
"redaction_policy": "[[rules]]\npath = \"PID.3\"\naction = \"hash\"\nreason = \"patient identifier\"\n[[rules]]\npath = \"PID.5\"\naction = \"drop\"\nreason = \"patient name\"\n"
}'
```
For a full operator walkthrough, see the
[Deploy Validation Sidecar guide](https://github.com/EffortlessMetrics/hl7v2-rs/blob/main/docs/guides/deploy-validation-sidecar.md).
For source examples, see the
[examples/](https://github.com/EffortlessMetrics/hl7v2-rs/tree/main/examples)
directory in the root of the repository.