Schedule a demo
Segment

Diagnosis related group

Carries the diagnosis related group classification assigned to an inpatient encounter, including the DRG code, approval indicators, grouper version, and outlier information. It is used in BAR and DFT messages in inpatient billing workflows, typically sent by grouper or coding systems to patient accounting and claims systems for prospective payment reimbursement calculations.

33fields
0required
v2.9HL7 version
drg.py
from zato.hl7v2 import DRG

drg = DRG()
drg.diagnostic_related_group = '462'
drg.drg_approval_indicator = 'Y'
drg.effective_weight = '1.2'

Build DRG segments in Python

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

1

Routine classification

DRG assignment with date, approval indicator, and grouper review code

from zato.hl7v2.v2_9 import DRG
from zato.hl7v2.v2_9 import CNE, CWE

drg = DRG()
drg.diagnostic_related_group = CNE(
    identifier='462',
    text='ROUTINE WELLNESS',
    name_of_coding_system='HL70055'
)
drg.drg_assigned_date_time = '20240315120000'
drg.drg_approval_indicator = 'Y'
drg.drg_grouper_review_code = CWE(
    identifier='0',
    text='NO REVIEW NEEDED',
    name_of_coding_system='HL70056'
)
2

Financial processing

DRG with effective weight, monetary amount, and total charge for billing

from zato.hl7v2.v2_9 import DRG
from zato.hl7v2.v2_9 import CNE, MO

drg = DRG()
drg.diagnostic_related_group = CNE(
    identifier='470',
    text='WELLNESS CHECKUP',
    name_of_coding_system='HL70055'
)
drg.drg_assigned_date_time = '20240401090000'
drg.drg_approval_indicator = 'Y'
drg.effective_weight = '1.05'
drg.monetary_amount = MO(quantity='7500.00')
drg.total_charge = MO(quantity='7500.00')
3

Coder assignment

DRG with coder name, grouper software details, and status fields

from zato.hl7v2.v2_9 import DRG
from zato.hl7v2.v2_9 import CNE, CWE, XPN

drg = DRG()
drg.diagnostic_related_group = CNE(
    identifier='391',
    text='ROUTINE NEWBORN',
    name_of_coding_system='HL70055'
)
drg.drg_assigned_date_time = '20240501140000'
drg.drg_approval_indicator = 'Y'
drg.name_of_coder = XPN(
    family_name='CHEN',
    given_name='LISA',
    middle_name='M'
)
drg.grouper_status = CWE(
    identifier='0',
    text='COMPLETE',
    name_of_coding_system='HL70734'
)
drg.grouper_software_name = 'ACME GROUPER'
drg.grouper_software_version = '4.2'

Learn by building

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

Frequently asked questions

DRG carries the diagnosis related group classification for a patient encounter - the DRG code, approval status, grouper review details, financial calculations, coder information, and various status fields. It appears in ADT, BAR, and DFT messages for reimbursement and billing workflows.

Create the segment and access its fields directly:

from zato.hl7v2.v2_9 import DRG, CNE

drg = DRG()
drg.diagnostic_related_group = CNE(
    identifier='462',
    text='ROUTINE WELLNESS',
    name_of_coding_system='HL70055'
)
drg.drg_approval_indicator = 'Y'
drg.effective_weight = '1.2'

code = drg.diagnostic_related_group
approved = drg.drg_approval_indicator
weight = drg.effective_weight

The diagnostic_related_group field uses the CNE (coded with no exceptions) datatype with HL7 table 0055:

from zato.hl7v2.v2_9 import DRG, CNE

drg = DRG()
drg.diagnostic_related_group = CNE(
    identifier='462',
    text='ROUTINE WELLNESS',
    name_of_coding_system='HL70055'
)

Use the monetary amount and charge fields with the MO (money) datatype:

from zato.hl7v2.v2_9 import DRG, MO

drg = DRG()
drg.effective_weight = '1.05'
drg.monetary_amount = MO(quantity='7500.00')
drg.total_charge = MO(quantity='7500.00')
drg.basic_charge = MO(quantity='6800.00')

The name_of_coder field uses the XPN (extended person name) datatype:

from zato.hl7v2.v2_9 import DRG, XPN

drg = DRG()
drg.name_of_coder = XPN(
    family_name='Chen',
    given_name='Lisa',
    middle_name='M'
)
drg.grouper_software_name = 'ACME GROUPER'
drg.grouper_software_version = '4.2'

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.

DRG field reference

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

#Python nameDatatypeUsageRepeatableTable
1diagnostic_related_groupCNEOptionalNoHL70055
2drg_assigned_date_timeDTMOptionalNo-
3drg_approval_indicatorIDOptionalNoHL70136
4drg_grouper_review_codeCWEOptionalNoHL70056
5outlier_typeCWEOptionalNoHL70083
6outlier_daysNMOptionalNo-
7outlier_costCPOptionalNo-
8drg_payorCWEOptionalNoHL70229
9outlier_reimbursementCPOptionalNo-
10confidential_indicatorIDOptionalNoHL70136
11drg_transfer_typeCWEOptionalNoHL70415
12name_of_coderXPNOptionalNo-
13grouper_statusCWEOptionalNoHL70734
14pccl_value_codeCWEOptionalNoHL70728
15effective_weightNMOptionalNo-
16monetary_amountMOOptionalNo-
17status_patientCWEOptionalNoHL70739
18grouper_software_nameSTOptionalNo-
19grouper_software_versionSTOptionalNo-
20status_financial_calculationCWEOptionalNoHL70742
21relative_discount_surchargeMOOptionalNo-
22basic_chargeMOOptionalNo-
23total_chargeMOOptionalNo-
24discount_surchargeMOOptionalNo-
25calculated_daysNMOptionalNo-
26status_genderCWEOptionalNoHL70749
27status_ageCWEOptionalNoHL70749
28status_length_of_stayCWEOptionalNoHL70749
29status_same_day_flagCWEOptionalNoHL70749
30status_separation_modeCWEOptionalNoHL70749
31status_weight_at_birthCWEOptionalNoHL70755
32status_respiration_minutesCWEOptionalNoHL70757
33status_admissionCWEOptionalNoHL70759

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python