I see the TS
and DT
data types in the default 2.3 schema:
<SegmentStructure name='SMPL' description='Patient Identification'>
<SegmentSubStructure piece='1' description='A sample datetime field' datatype='DT' max_length='12' required='O' ifrepeating='0'/>
</SegmentStructure>
<DataType name='TS' description='time stamp'>
<DataSubType piece='1' description='time of an event' datatype='ST'/>
<DataSubType piece='2' description='degree of precision' datatype='ST'/>
</DataType>
<DataType name='DT' description='Date (2.8.13)'>
<DataSubType piece='1' description='Date (2.8.13)'/>
</DataType>
but it doesn't appear that it would actually validate the format. Is this possible? We had an instance recently where a customer was sending a timestamp with a missing digit (20160503120 for example). I would like to validate this with the schema if I can.
edit: Adding a some clarification hopefully
We use intersystems-healthshare and when an ADT comes in it passes through a validator with the extension .hl7
. By default this is 2.3.hl7
or similar (depending on the version). It looks just like the code above. I want to know if I can put regex in there somehow. Either in the segment structure definition (SMPL) or in the data type definition.
You could add a regex to the schema. This is the full TS regex from the v3 schemas:
[0-9]{1,8}|([0-9]{9,14}|[0-9]{14,14}.[0-9]+)([+-][0-9]{1,4})?