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.
from zato.hl7v2 import RGS
rgs = RGS()
rgs.set_id_rgs = '1'
rgs.segment_action_code = 'A'How to construct and work with real-world RGS segments.
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'
)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'
)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'
)Step-by-step guides for working with HL7 v2 in Zato.
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.
Complete list of fields in the RGS segment, HL7 v2.9.
| # | Python name | Datatype | Usage | Repeatable | Table |
|---|---|---|---|---|---|
| 1 | set_id_rgs | SI | Required | No | - |
| 2 | segment_action_code | ID | Optional | No | HL70206 |
| 3 | resource_group_id | CWE | Optional | No | - |
Get started with Zato and connect your systems in minutes.