@@ -275,6 +275,7 @@ def _parse_value(self, value):
275275
276276class FloatField (FieldRenderFormatStringMixin , DataElementField ):
277277 type = 'float'
278+ ## FIXME: Not implemented, no one uses this?
278279
279280class BinaryField (DataElementField ):
280281 type = 'bin'
@@ -287,6 +288,56 @@ def _render_value(self, value):
287288
288289 def _parse_value (self , value ): return bytes (value )
289290
291+ class FixedLengthMixin :
292+ FIXED_LENGTH = [None , None , None ]
293+
294+ def __init__ (self , * args , ** kwargs ):
295+ for i , a in enumerate (('length' , 'min_length' , 'max_length' )):
296+ kwargs [a ] = self .FIXED_LENGTH [i ] if len (self .FIXED_LENGTH ) > i else None
297+
298+ super ().__init__ (* args , ** kwargs )
299+
300+ class IDField (FixedLengthMixin , AlphanumericField ):
301+ type = 'id'
302+ FIXED_LENGTH = [None , None , 30 ]
303+
304+ class BooleanField (FixedLengthMixin , AlphanumericField ):
305+ type = 'jn'
306+ FIXED_LENGTH = [1 ]
307+
308+ def _render_field (self , value ):
309+ return "J" if value else "N"
310+
311+ def _parse_field (self , value ):
312+ if value is None :
313+ return None
314+ if value == "J" :
315+ return True
316+ elif value == "N" :
317+ return False
318+ else :
319+ raise ValueError ("Invalid value {!r} for BooleanField" .format (value ))
320+
321+ class CodeField (AlphanumericField ):
322+ type = 'code'
323+
324+ ## FIXME: Not further implemented, might want to use Enums
325+
326+ class CountryField (FixedLengthMixin , DigitsField ):
327+ type = 'ctr'
328+ FIXED_LENGTH = [3 ]
329+
330+ class CurrencyField (FixedLengthMixin , AlphanumericField ):
331+ type = 'cur'
332+ FIXED_LENGTH = [3 ]
333+
334+ class DateField (FixedLengthMixin , NumericField ):
335+ type = 'dat'
336+ FIXED_LENGTH = [8 ]
337+
338+ class TimeField (FixedLengthMixin , DigitsField ):
339+ type = 'tim'
340+ FIXED_LENGTH = [6 ]
290341
291342class SegmentSequence :
292343 def __init__ (self , segments = None ):
0 commit comments