Stream: implementers
Topic: extension-regex usage
Reece Adamson (Jul 05 2019 at 03:24):
Looking at the StructureDefinitions in profiles-types.json
from the master set of FHIR definitions I noticed that the extension-regex for Extension.url
is on the ElementDefinition.type.code
, whereas the other StructureDefinitions with a regex have it on the ElementDefinition.type
.
For reference the Extension.url regex extension looks like this:
{ "id": "Extension.url", "path": "Extension.url", "representation": [ "xmlAttr" ], "comment": "The definition may point directly to a computable or human-readable definition of the extensibility codes, or it may be a logical URI as declared in some other specification. The definition SHALL be a URI for the Structure Definition defining the extension.", "min": 1, "max": "1", "base": { "path": "Extension.url", "min": 1, "max": "1" }, "type": [ { "_code": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type", "valueString": "string" }, { "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type", "valueString": "xsd:string" }, { "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-rdf-type", "valueString": "xsd:string" }, { "url": "http://hl7.org/fhir/StructureDefinition/regex", "valueString": "((http|https)://([A-Za-z0-9\\\\\\.\\:\\%\\$]*\\/)*)?(Account|ActivityDefinition|AdverseEvent|AllergyIntolerance|Appointment|AppointmentResponse|AuditEvent|Basic|Binary|BiologicallyDerivedProduct|BodyStructure|Bundle|CapabilityStatement|CarePlan|CareTeam|CatalogEntry|ChargeItem|ChargeItemDefinition|Claim|ClaimResponse|ClinicalImpression|CodeSystem|Communication|CommunicationRequest|CompartmentDefinition|Composition|ConceptMap|Condition|Consent|Contract|Coverage|CoverageEligibilityRequest|CoverageEligibilityResponse|DetectedIssue|Device|DeviceDefinition|DeviceMetric|DeviceRequest|DeviceUseStatement|DiagnosticReport|DocumentManifest|DocumentReference|EffectEvidenceSynthesis|Encounter|Endpoint|EnrollmentRequest|EnrollmentResponse|EpisodeOfCare|EventDefinition|Evidence|EvidenceVariable|ExampleScenario|ExplanationOfBenefit|FamilyMemberHistory|Flag|Goal|GraphDefinition|Group|GuidanceResponse|HealthcareService|ImagingStudy|Immunization|ImmunizationEvaluation|ImmunizationRecommendation|ImplementationGuide|InsurancePlan|Invoice|Library|Linkage|List|Location|Measure|MeasureReport|Media|Medication|MedicationAdministration|MedicationDispense|MedicationKnowledge|MedicationRequest|MedicationStatement|MedicinalProduct|MedicinalProductAuthorization|MedicinalProductContraindication|MedicinalProductIndication|MedicinalProductIngredient|MedicinalProductInteraction|MedicinalProductManufactured|MedicinalProductPackaged|MedicinalProductPharmaceutical|MedicinalProductUndesirableEffect|MessageDefinition|MessageHeader|MolecularSequence|NamingSystem|NutritionOrder|Observation|ObservationDefinition|OperationDefinition|OperationOutcome|Organization|OrganizationAffiliation|Patient|PaymentNotice|PaymentReconciliation|Person|PlanDefinition|Practitioner|PractitionerRole|Procedure|Provenance|Questionnaire|QuestionnaireResponse|RelatedPerson|RequestGroup|ResearchDefinition|ResearchElementDefinition|ResearchStudy|ResearchSubject|RiskAssessment|RiskEvidenceSynthesis|Schedule|SearchParameter|ServiceRequest|Slot|Specimen|SpecimenDefinition|StructureDefinition|StructureMap|Subscription|Substance|SubstanceNucleicAcid|SubstancePolymer|SubstanceProtein|SubstanceReferenceInformation|SubstanceSourceMaterial|SubstanceSpecification|SupplyDelivery|SupplyRequest|Task|TerminologyCapabilities|TestReport|TestScript|ValueSet|VerificationResult|VisionPrescription)\\/[A-Za-z0-9\\-\\.]{1,64}(\\/_history\\/[A-Za-z0-9\\-\\.]{1,64})?" } ] } } ], "isModifier": false, "isSummary": false }
whereas the other FHIR datatypes, like uri, have it on the type element:
{ "id": "uri.value", "path": "uri.value", "representation": [ "xmlAttr" ], "min": 0, "max": "1", "base": { "path": "uri.value", "min": 0, "max": "1" }, "type": [ { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/regex", "valueString": "\\S*" } ], "_code": { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type", "valueString": "string" }, { "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type", "valueString": "xsd:anyURI" }, { "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-rdf-type", "valueString": "xsd:string" } ] } } ], "isModifier": false, "isSummary": false }
based on the context from the regex-extension StructureDefinition I was expecting it to be on the ElementDefinition. I can see that it might be undesirable to have it on the ElementDefinition because of elements that have a choice of type.
"context": [ { "type": "element", "expression": "Questionnaire.item" }, { "type": "element", "expression": "ElementDefinition" } ]
Is there a reason for putting the regex-extension in one place or the other and should they be treated differently depending on if its on the type or the type.code?
Grahame Grieve (Jul 05 2019 at 09:26):
should be consistent. But I'm not sure where it should be
Lloyd McKenzie (Jul 05 2019 at 14:10):
It should be on ElementDefinition. We're qualifying the whole definition and that's where we put other constraints like maxLength.
Reece Adamson (Jul 08 2019 at 14:13):
Thanks! Should I submit a tracker ticket for this? I'd be happy to help implement a fix if desired.
Lloyd McKenzie (Jul 08 2019 at 16:20):
Please. And a pull request is always welcome
Last updated: Apr 12 2022 at 19:14 UTC