Schedule a demo
Segment

Patient visit - additional information

Carries supplemental visit information beyond what PV1 provides, such as expected admit and discharge dates, visit description, admit reason, transfer reason, and precaution or isolation codes. It follows PV1 in ADT messages and is used by registration systems to communicate additional encounter context to downstream systems like nursing or case management applications.

50fields
0required
v2.9HL7 version
pv2.py
from zato.hl7v2 import PV2

pv2 = PV2()
pv2.admit_reason = 'SC'
pv2.transfer_reason = 'TRANS'
pv2.visit_description = 'Annual wellness visit'
pv2.patient_status_code = 'ST'

Build PV2 segments in Python

How to construct and work with real-world PV2 segments.

1

Admission reason

PV2 with admit reason, transfer reason, and expected stay

from zato.hl7v2.v2_9 import PV2
from zato.hl7v2.v2_9 import CWE

pv2 = PV2()
pv2.accommodation_code = CWE(identifier='AC')
pv2.admit_reason = CWE(identifier='SC', text='Scheduled procedure')
pv2.transfer_reason = CWE(identifier='TRANS', text='Ward transfer')
pv2.estimated_length_of_inpatient_stay = '3'
2

Visit description and referral

PV2 with visit description and referral source

from zato.hl7v2.v2_9 import PV2
from zato.hl7v2.v2_9 import CWE, XCN

pv2 = PV2()
pv2.estimated_length_of_inpatient_stay = '5'
pv2.visit_description = 'Annual physical, wellness check'
pv2.referral_source_code = XCN(
    person_identifier='7890',
    family_name='GARCIA',
    given_name='MARIA',
    suffix='MD'
)
3

Expected dates

PV2 with expected admit and discharge dates

from zato.hl7v2.v2_9 import PV2

pv2 = PV2()
pv2.expected_admit_date_time = '20240601080000'
pv2.expected_discharge_date_time = '20240604120000'

Learn by building

Step-by-step guides for working with HL7 v2 in Zato.

Frequently asked questions

PV2 provides additional visit details that extend PV1, such as the reason for admission, expected length of stay, visit description, referral source, living will status, and organ donor code. It always accompanies a PV1 segment.

The admit_reason field is a CWE datatype with an identifier and descriptive text:

from zato.hl7v2.v2_9 import PV2, CWE

pv2 = PV2()
pv2.admit_reason = CWE(
    identifier='SC',
    text='Scheduled procedure'
)

Use the expected_admit_date_time and expected_discharge_date_time fields:

from zato.hl7v2.v2_9 import PV2

pv2 = PV2()
pv2.expected_admit_date_time = '20240601080000'
pv2.expected_discharge_date_time = '20240604120000'

The referral_source_code field uses the XCN (extended composite name) datatype to identify the referring clinician:

from zato.hl7v2.v2_9 import PV2, XCN

pv2 = PV2()
pv2.referral_source_code = XCN(
    person_identifier='7890',
    family_name='Garcia',
    given_name='Maria',
    suffix='MD'
)

Zato connects to any system that speaks HL7v2 over MLLP or FHIR over REST. This includes Epic, Cerner, Meditech, Allscripts, and other EHR platforms.

Yes, Zato has built-in MLLP support for sending and receiving HL7v2 messages. MLLP channels handle the framing protocol automatically.

Zato supports HL7 v2.9, which is backward compatible with earlier versions including v2.3, v2.5, and v2.7. Standard segments and datatypes are available as typed Python classes.

Yes. Zato handles both HL7v2 and FHIR natively, so you can parse v2 messages and build FHIR resources with IG-specific extensions in the same service. Typed Python classes are available for both protocols, including extensions from US Core, UK Core, Da Vinci, and other Implementation Guides.

PV2 field reference

Complete list of fields in the PV2 segment, HL7 v2.9.

#Python nameDatatypeUsageRepeatableTable
1prior_pending_locationPLOptionalNo-
2accommodation_codeCWEOptionalNoHL70129
3admit_reasonCWEOptionalNo-
4transfer_reasonCWEOptionalNo-
5patient_valuablesSTOptionalYes-
6patient_valuables_locationSTOptionalNo-
7visit_user_codeCWEOptionalYesHL70130
8expected_admit_date_timeDTMOptionalNo-
9expected_discharge_date_timeDTMOptionalNo-
10estimated_length_of_inpatient_stayNMOptionalNo-
11actual_length_of_inpatient_stayNMOptionalNo-
12visit_descriptionSTOptionalNo-
13referral_source_codeXCNOptionalYes-
14previous_service_dateDTOptionalNo-
15employment_illness_related_indicatorIDOptionalNoHL70136
16purge_status_codeCWEOptionalNoHL70213
17purge_status_dateDTOptionalNo-
18special_program_codeCWEOptionalNoHL70214
19retention_indicatorIDOptionalNoHL70136
20expected_number_of_insurance_plansNMOptionalNo-
21visit_publicity_codeCWEOptionalNoHL70215
22visit_protection_indicatorIDOptionalNoHL70136
23clinic_organization_nameXONOptionalYes-
24patient_status_codeCWEOptionalNoHL70216
25visit_priority_codeCWEOptionalNoHL70217
26previous_treatment_dateDTOptionalNo-
27expected_discharge_dispositionCWEOptionalNoHL70112
28signature_on_file_dateDTOptionalNo-
29first_similar_illness_dateDTOptionalNo-
30patient_charge_adjustment_codeCWEOptionalNoHL70218
31recurring_service_codeCWEOptionalNoHL70219
32billing_media_codeIDOptionalNoHL70136
33expected_surgery_date_and_timeDTMOptionalNo-
34military_partnership_codeIDOptionalNoHL70136
35military_non_availability_codeIDOptionalNoHL70136
36newborn_baby_indicatorIDOptionalNoHL70136
37baby_detained_indicatorIDOptionalNoHL70136
38mode_of_arrival_codeCWEOptionalNoHL70430
39recreational_drug_use_codeCWEOptionalYesHL70431
40admission_level_of_care_codeCWEOptionalNoHL70432
41precaution_codeCWEOptionalYesHL70433
42patient_condition_codeCWEOptionalNoHL70434
43living_will_codeCWEOptionalNoHL70315
44organ_donor_codeCWEOptionalNoHL70316
45advance_directive_codeCWEOptionalYesHL70435
46patient_status_effective_dateDTOptionalNo-
47expected_loa_return_date_timeDTMOptionalNo-
48expected_pre_admission_testing_date_timeDTMOptionalNo-
49notify_clergy_codeCWEOptionalYesHL70534
50advance_directive_last_verified_dateDTOptionalNo-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python