crs4 / hl7apy

Python library to parse, create and handle HL7 v2 messages.
http://crs4.github.io/hl7apy/
MIT License
215 stars 85 forks source link

How to add custom Segment structure in order to parse them easily #88

Closed codeKonami closed 3 years ago

codeKonami commented 3 years ago

Hello,

Is there a way to add some custom Segments and Fields to be able to parse them afterwards ?

Something like :


hl7apy.add_segment(
'ZBE': ('sequence',
            (('ZBE_1', FIELDS['ZBE_1'], (0, 1), 'FIE'),
             ('ZBE_2', FIELDS['ZBE_2'], (0, 1), 'FIE'),
             ('ZBE_3', FIELDS['ZBE_3'], (0, 1), 'FIE'),
))
svituz commented 3 years ago

Hi, @codeKonami. Z-segments are supported without the need to specify the structure. Here you can see how they work, what is allowed and what is not. If you want to specify the structure of the segment, use message profiles

codeKonami commented 3 years ago

Thanks @svituz!