Stream: conformance
Topic: FHIR Specification
Eric Prud'hommeaux (Dec 10 2021 at 15:51):
what's the source for the 3rd column (XML Representation
) in datatypes Primitive Types table? (I'm happy to move this topic wherever it should be.)
Eric Prud'hommeaux (Dec 10 2021 at 15:52):
Specifically, does it appear in e.g. the JSON resource defs available on the downloads page?
Grahame Grieve (Dec 10 2021 at 19:51):
it does, yes.
Grahame Grieve (Dec 10 2021 at 19:51):
from the integer definition:
Grahame Grieve (Dec 10 2021 at 19:52):
.... no, it doesn't
Grahame Grieve (Dec 10 2021 at 19:53):
it did in R3:
Grahame Grieve (Dec 10 2021 at 19:53):
{
"url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type",
"valueString": "xsd:int"
},
Grahame Grieve (Dec 10 2021 at 19:53):
but I've removed that. I don't even remember why I did that
Eric Prud'hommeaux (Dec 10 2021 at 20:10):
the semantics of structuredefinition-xml-type
is that in any XML representation (or, from my perspective, the valueString represents a QName which supercedes the stated type?
Eric Prud'hommeaux (Dec 10 2021 at 20:11):
but yeah, i don't see 'em
Eric Prud'hommeaux (Dec 10 2021 at 20:11):
should i hard-wire?:
{
"boolean": { "XMLRepresentation": "xs:boolean", "caveats": "0 and 1 are not valid values" },
"integer": { "XMLRepresentation": "xs:int", "caveats": "leading 0 digits are not allowed" },
"integer64": { "XMLRepresentation": "xs:long", "caveats": "leading 0 digits are not allowed" },
"string": { "XMLRepresentation": "xs:string" },
"decimal": { "XMLRepresentation": ["xs:decimal", "xs:double"] },
"uri": { "XMLRepresentation": "xs:anyURI" },
"url": { "XMLRepresentation": "xs:anyURI" },
"canonical": { "XMLRepresentation": "xs:anyURI" },
"base64Binary": { "XMLRepresentation": "xs:base64Binary" },
"instant": { "XMLRepresentation": "xs:dateTime" },
"date": { "XMLRepresentation": ["xs:date", "xs:gYearMonth", "xs:gYear"] },
"dateTime": { "XMLRepresentation": ["xs:dateTime", "xs:date", "xs:gYearMonth", "xs:gYear"] },
"time": { "XMLRepresentation": "xs:time" },
"code": { "XMLRepresentation": "xs:token" },
"oid": { "XMLRepresentation": "xs:anyURI" },
"id": { "XMLRepresentation": "xs:string" },
"markdown": { "XMLRepresentation": "xs:string" },
"unsignedInt": { "XMLRepresentation": "xs:nonNegativeInteger" },
"positiveInt": { "XMLRepresentation": "xs:positiveInteger" },
"uuid": { "XMLRepresentation": "xs:anyURI" }
}
Eric Prud'hommeaux (Dec 10 2021 at 20:13):
there's structuredefinition-fhir-type
, but it doesn't seem to have the same mapping to xsd
Grahame Grieve (Dec 10 2021 at 20:52):
no. it doesn't. So yes, that table you made, that's the best way
Eric Prud'hommeaux (Dec 10 2021 at 20:52):
guess i won't delete it then
Eric Prud'hommeaux (Dec 10 2021 at 20:52):
tx!
Gino Canessa (Dec 10 2021 at 21:11):
Grahame Grieve said:
but I've removed that. I don't even remember why I did that
These were replaced with the internal FHIR Types when they were added. I think the reasoning was that the core type system should be independent of any serialization / parsing details from a specific format, but I'm a bit hazy on remembering.
Grahame Grieve (Dec 10 2021 at 21:12):
there isn't a 1:1 mapping from the internal type to schema, and that's still useful for things like what Eric is doing, so I regret removing it now
Lloyd McKenzie (Dec 11 2021 at 05:30):
I vaguely also recall they broke one of our validation rules, but don't remember what
Eric Prud'hommeaux (Dec 16 2021 at 10:05):
(apologies for long pastes) if datatypes has:
{
"fullUrl": "http://hl7.org/fhir/StructureDefinition/string",
"resource": {
"resourceType": "StructureDefinition", "id": "string",
"kind": "primitive-type", "abstract": false, "type": "string",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/PrimitiveType",
"derivation": "specialization",
"differential": {
"element": [
{ "id": "string.value", "min": 0, "max": "1", "type": [
{ "extension": [
{ "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", "valueUri": "string" },
{ "url": "http://hl7.org/fhir/StructureDefinition/regex", "valueString": "[ \\r\\n\\t\\S]+" } ],
"code": "http://hl7.org/fhirpath/System.String"
} ] } ] } } },
{
"fullUrl": "http://hl7.org/fhir/StructureDefinition/code",
"resource": {
"resourceType": "StructureDefinition", "id": "code",
"kind": "primitive-type", "abstract": false, "type": "code",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/string",
"derivation": "specialization",
"differential": {
"element": [
{ "id": "code.value", "min": 0, "max": "1", "type": [
{ "extension": [
{ "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", "valueUri": "code" },
{ "url": "http://hl7.org/fhir/StructureDefinition/regex", "valueString": "[^\\s]+( [^\\s]+)*" } ],
"code": "http://hl7.org/fhirpath/System.String"
} ] } ] } } },
, how do I know that code.value
restricts string.value
?
Eric Prud'hommeaux (Dec 16 2021 at 10:18):
https://build.fhir.org/structuredefinition-definitions#StructureDefinition.derivation
If the definition is a specialization, then it adds new elements in the differential, and the snapshot includes the inherited elements. If the definition is a constraint, then it cannot define new elements, it can only make new rules about existing content
I guess "specialization" can both add new elements and constrain already-defined ones? (otherwise, what would you do with collisions?)
Grahame Grieve (Dec 16 2021 at 17:27):
yes it can
Last updated: Apr 12 2022 at 19:14 UTC