Apply rule_templates to a raw HL7 message

Apply a set of rule_template records to a raw HL7 v2.x message. The ``rules`` list contains rule_template records fetched from the external API. This service does not store them — it only executes them. Only ``is_active=true`` rules are applied, sorted by ``position`` ascending. Rules with ``condition_data`` are skipped when their condition is not met. Returns the original message, the transformed message, and a per-rule log. When ``include_diff=true``, a ``diff`` field carries the before/after state of the message around each rule, for the UI to debug modifications.

Authentication

AuthorizationBearer

Static shared-secret token for internal service-to-service calls.

Query parameters

include_diffbooleanOptionalDefaults to false

When true, include a per-rule before/after diff in the response.

Request

This endpoint expects an object.
messagestringRequired

Raw HL7 v2.x message (segments separated by \r or \n)

ruleslist of objectsRequired

rule_template records to apply (from the external service)

Response

Successful Response
original_messagestring
transformed_messagestring
resultslist of objects
difflist of objects or null

Per-rule before/after snapshots; present only with include_diff

Errors

422
Unprocessable Entity Error