FHIR Primitive Types
Primitive data types.
Base64Binary
module-attribute
Base64Binary = TypeAliasType('Base64Binary', Annotated[str, Field(pattern='(\\s*([0-9a-zA-Z\\+\\=]){4}\\s*)+')])
Boolean
module-attribute
Boolean = TypeAliasType('Boolean', Union[bool, Annotated[str, Field(pattern='true|false'), AfterValidator(lambda x: x == 'true')]])
Code
module-attribute
Code = TypeAliasType('Code', Annotated[str, Field(pattern='[^\\s]+(\\s[^\\s]+)*')])
Date
module-attribute
Date = TypeAliasType('Date', Union[Annotated[date, Field(), AfterValidator(lambda d: isoformat())], Annotated[str, Field(pattern=f'{YEAR_REGEX}(-{MONTH_REGEX}(-{DAY_REGEX})?)?')]])
DateTime
module-attribute
DateTime = TypeAliasType('DateTime', Union[Annotated[datetime, Field(), AfterValidator(lambda d: isoformat())], Annotated[str, Field(pattern=f'{YEAR_REGEX}(-{MONTH_REGEX}(-{DAY_REGEX})?)?(T{HOUR_REGEX}(:{MINUTES_REGEX}(:{SECONDS_REGEX}({TIMEZONE_REGEX})?)?)?)?')]])
Decimal
module-attribute
Decimal = TypeAliasType('Decimal', Union[float, Annotated[str, Field(pattern='-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?'), AfterValidator(float)]])
Id
module-attribute
Id = TypeAliasType('Id', Annotated[str, Field(pattern='[A-Za-z0-9\\-\\.]{1,64}')])
Instant
module-attribute
Instant = TypeAliasType('Instant', Union[Annotated[datetime, Field(), AfterValidator(lambda d: isoformat())], Annotated[str, Field(pattern=f'{YEAR_REGEX}-{MONTH_REGEX}-{DAY_REGEX}T{HOUR_REGEX}:{MINUTES_REGEX}:{SECONDS_REGEX}({TIMEZONE_REGEX})?')]])
Integer
module-attribute
Integer = TypeAliasType('Integer', Union[int, Annotated[str, Field(pattern='[0]|[-+]?[1-9][0-9]*'), AfterValidator(int)]])
Integer64
module-attribute
Integer64 = TypeAliasType('Integer64', Union[int, Annotated[str, Field(pattern='[0]|[-+]?[1-9][0-9]*'), AfterValidator(int)]])
Markdown
module-attribute
Markdown = TypeAliasType('Markdown', Annotated[str, Field(pattern='\\s*(\\S|\\s)*')])
Oid
module-attribute
Oid = TypeAliasType('Oid', Annotated[str, Field(pattern='urn:oid:[0-2](\\.(0|[1-9][0-9]*))+')])
PositiveInt
module-attribute
PositiveInt = TypeAliasType('PositiveInt', Union[Annotated[int, Field(gt=0)], Annotated[str, Field(pattern='\\+?[1-9][0-9]*'), AfterValidator(__integer_validator(lambda x: x > 0))]])
Time
module-attribute
Time = TypeAliasType('Time', Union[Annotated[time, Field(), AfterValidator(lambda t: isoformat())], Annotated[str, Field(pattern=f'{HOUR_REGEX}(:{MINUTES_REGEX}(:{SECONDS_REGEX}({TIMEZONE_REGEX})?)?)?')]])
UnsignedInt
module-attribute
UnsignedInt = TypeAliasType('UnsignedInt', Union[Annotated[int, Field(ge=0)], Annotated[str, Field(pattern='[0]|([1-9][0-9]*)'), AfterValidator(__integer_validator(lambda x: x >= 0))]])