Skip to content

Missing required child OML_O21_ORDER_PRIOR.OML_O21_OBSERVATION_PRIOR #148

Description

@mungra

Hi,

How can i parse OML message strings with multiple ORC group without prior obx using strict validation (required).
exception : Missing required child OML_O21_ORDER_PRIOR.OML_O21_OBSERVATION_PRIOR

setting find_groups=False gives me different exception : PID is not a valid child for which doesnt make sense.

MSH|^~&|ClinicSystem|MainClinic|LaboratorySystem|MainHospital|20250709160000||OML^O21^OML_O21|MSG00028|P|2.7||||||||||
PID|1||GP-000001^^^^MR||Doe^John||19801029|446151000124109^Male^SCT||||||||U^Unknown||||||||N||||||||||||||||
ORC|NW|LAB123456|ORD987654|||||||98765^Doe^John
OBR|1|LAB123456|ORD987654|1234^Complete Blood Count^L|||20250709160000|||||||||98765^Doe^John
NTE|1|L|Sample collected in the morning.
ORC|NW|IMG123456|ORD987655|||||||98765^Doe^John
OBR|2|IMG123456|ORD987655|5678^Chest X-Ray^L|||20250709160000|||||||||98765^Doe^John
NTE|2|L|Patient has a history of asthma.

using hl7 v2.7

try:
    cleaned_message = message.replace('\r\n', '\r').replace('\n', '\r')
    return parse_message(cleaned_message, version="2.7", validation_level=VALIDATION_LEVEL.STRICT, force_validation=True, find_groups=True)
except HL7apyException as e:
    raise Exception(f"Invalid HL7 message: {e}")

Regards,
Mungra

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions