Schedule a demo
Segment

Resource group

Defines a logical grouping of resources within scheduling and appointment messages. It carries a set identifier, an optional action code indicating whether the group is being added, updated, or deleted, and an optional coded resource group identifier. It appears in scheduling messages (S12-S26) and is used by scheduling systems to organize related resources such as rooms, equipment, and personnel into bookable units.

3fields
1required
v2.9HL7 version
rgs.py
from zato.hl7v2 import RGS

rgs = RGS()
rgs.set_id_rgs = '1'
rgs.segment_action_code = 'A'

Build RGS segments in Python

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

1

New resource group

Resource group creation with set ID, add action code, and group identifier

from zato.hl7v2.v2_9 import RGS
from zato.hl7v2.v2_9 import CWE

rgs = RGS()
rgs.set_id_rgs = '1'
rgs.segment_action_code = 'A'
rgs.resource_group_id = CWE(
    identifier='GRP-100',
    text='Radiology suite',
    name_of_coding_system='L'
)
2

Updated resource group

Resource group update with modified group identifier and update action code

from zato.hl7v2.v2_9 import RGS
from zato.hl7v2.v2_9 import CWE

rgs = RGS()
rgs.set_id_rgs = '2'
rgs.segment_action_code = 'U'
rgs.resource_group_id = CWE(
    identifier='GRP-200',
    text='OR Suite B',
    name_of_coding_system='L'
)
3

Deleted resource group

Resource group deletion using the delete action code with group identifier

from zato.hl7v2.v2_9 import RGS
from zato.hl7v2.v2_9 import CWE

rgs = RGS()
rgs.set_id_rgs = '3'
rgs.segment_action_code = 'D'
rgs.resource_group_id = CWE(
    identifier='GRP-300',
    text='Lab Station 5',
    name_of_coding_system='L'
)

Learn by building

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

Frequently asked questions

RGS defines a logical grouping of resources within scheduling messages. Each RGS instance represents one bookable unit that may include rooms, equipment, and personnel. It appears in scheduling messages S12 through S26.

The segment_action_code field uses HL7 table 0206. Common values are A (Add), U (Update), and D (Delete):

from zato.hl7v2.v2_9 import RGS

rgs = RGS()
rgs.set_id_rgs = '1'

# A = Add/Insert
rgs.segment_action_code = 'A'

# U = Update
rgs.segment_action_code = 'U'

# D = Delete
rgs.segment_action_code = 'D'

The resource_group_id field uses CWE to identify the group:

from zato.hl7v2.v2_9 import RGS, CWE

rgs = RGS()
rgs.set_id_rgs = '1'
rgs.resource_group_id = CWE(
    identifier='GRP-100',
    text='Radiology suite',
    name_of_coding_system='L'
)

Increment the set_id_rgs for each resource group instance in the message:

from zato.hl7v2.v2_9 import RGS, CWE

rgs1 = RGS()
rgs1.set_id_rgs = '1'
rgs1.resource_group_id = CWE(
    identifier='GRP-100',
    text='Radiology suite'
)

rgs2 = RGS()
rgs2.set_id_rgs = '2'
rgs2.resource_group_id = CWE(
    identifier='GRP-200',
    text='OR Suite B'
)

No, resource_group_id is optional. Only set_id_rgs is required. A minimal RGS needs just the set ID:

from zato.hl7v2.v2_9 import RGS

rgs = RGS()
rgs.set_id_rgs = '1'
rgs.segment_action_code = 'A'

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.

RGS field reference

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

#Python nameDatatypeUsageRepeatableTable
1set_id_rgsSIRequiredNo-
2segment_action_codeIDOptionalNoHL70206
3resource_group_idCWEOptionalNo-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python