# HL7 v2 in Python

Read, validate and transform HL7 v2 messages as typed Python objects.

## Get started

Streamline every clinical interface with effortless parsing, transformation and serialization of HL7 v2 messages.

[Parsing and serialization](https://zato.io/docs/dev/healthcare/hl7/v2/parsing/index.html)

service.py

```
# Parse any HL7 v2 message
from zato.hl7v2 import parse_hl7

message = parse_hl7(raw)

message.pid.patient_name.family_name
'SMITH'

message.to_json()
'{"msh": {"message_type": ...'

message.serialize()
'MSH|^~\&|SENDER|FACILITY|...'
```

## Read messages

[Parsing and serialization parse\_hl7 parses wire text into a typed object, which serializes back to ER7, dicts or JSON.](https://zato.io/docs/dev/healthcare/hl7/v2/parsing/index.html) [Field access Read and write any field by name, wire position or path string such as PID.5.1.](https://zato.io/docs/dev/healthcare/hl7/v2/field-access/index.html)

## Validate and transform

[Validation Check required fields and datatypes, with every problem reported at once.](https://zato.io/docs/dev/healthcare/hl7/v2/validation/index.html) [Batch processing Unpack and build FHS and BHS envelopes with many messages in one submission.](https://zato.io/docs/dev/healthcare/hl7/v2/batch/index.html)
