diff --git a/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs b/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs index 380f61da1..ae5c1561a 100644 --- a/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs +++ b/src/Hl7.Fhir.Base/ElementModel/ScopedNode.cs @@ -8,7 +8,6 @@ using Hl7.Fhir.Model; using Hl7.Fhir.Specification; -using Hl7.Fhir.Support.Poco; using Hl7.Fhir.Utility; using System; using System.Collections.Generic; @@ -94,9 +93,9 @@ private ScopedNode(ScopedNode parentNode, ScopedNode? parentResource, ITypedElem public NodeType Type => this switch { { AtResource: true } when Current.Children("contained").Any() => NodeType.DomainResource | NodeType.Resource, - { InstanceType: FhirTypeConstants.BUNDLE } => NodeType.Bundle | NodeType.Resource, + { InstanceType: FhirTypeNames.BUNDLE } => NodeType.Bundle | NodeType.Resource, { AtResource: true } => NodeType.Resource, - { InstanceType: FhirTypeConstants.REFERENCE or FhirTypeConstants.CANONICAL or FhirTypeConstants.CODEABLEREFERENCE } => NodeType.Reference, + { InstanceType: FhirTypeNames.REFERENCE or FhirTypeNames.CANONICAL or FhirTypeNames.CODEABLEREFERENCE } => NodeType.Reference, { Value: not null } => NodeType.Primitive, _ => 0 }; @@ -293,4 +292,4 @@ public IEnumerable Children(string? name = null) => public string ShortPath => Current is ElementNode en ? en.ShortPath : Current.Location; } -} +} \ No newline at end of file diff --git a/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs b/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs index 1e0301299..442327d8d 100644 --- a/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs +++ b/src/Hl7.Fhir.Base/ElementModel/TypedElementParseExtensions.cs @@ -9,7 +9,6 @@ */ using Hl7.Fhir.Model; -using Hl7.Fhir.Support.Poco; using System; using System.Collections.Generic; using System.Linq; @@ -47,14 +46,14 @@ public static class TypedElementParseExtensions { return instance.InstanceType switch { - FhirTypeConstants.CODE => instance.ParsePrimitiveInternal(), - FhirTypeConstants.STRING => new Code(instance.ParsePrimitiveInternal().Value), - FhirTypeConstants.URI => new Code(instance.ParsePrimitiveInternal().Value), - FhirTypeConstants.CODING => instance.ParseCodingInternal(), - FhirTypeConstants.CODEABLE_CONCEPT => instance.ParseCodeableConceptInternal(), - FhirTypeConstants.QUANTITY => parseQuantity(), - FhirTypeConstants.EXTENSION => parseExtension(), - FhirTypeConstants.CODEABLEREFERENCE => parseCodeableReference(), + FhirTypeNames.CODE => instance.ParsePrimitiveInternal(), + FhirTypeNames.STRING => new Code(instance.ParsePrimitiveInternal().Value), + FhirTypeNames.URI => new Code(instance.ParsePrimitiveInternal().Value), + FhirTypeNames.CODING => instance.ParseCodingInternal(), + FhirTypeNames.CODEABLE_CONCEPT => instance.ParseCodeableConceptInternal(), + FhirTypeNames.QUANTITY => parseQuantity(), + FhirTypeNames.EXTENSION => parseExtension(), + FhirTypeNames.CODEABLEREFERENCE => parseCodeableReference(), _ => null, }; diff --git a/src/Hl7.Fhir.Base/Model/FhirTypeConstants.cs b/src/Hl7.Fhir.Base/Model/FhirTypeConstants.cs deleted file mode 100644 index 8847be458..000000000 --- a/src/Hl7.Fhir.Base/Model/FhirTypeConstants.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021, Firely (info@fire.ly) and contributors - * See the file CONTRIBUTORS for details. - * - * This file is licensed under the BSD 3-Clause license - * available at https://github.com/FirelyTeam/firely-net-sdk/blob/master/LICENSE - */ - -namespace Hl7.Fhir.Support.Poco -{ - /// - /// List of Fhir types constants. This will be removed when we introduce ModelSpace, but for now we will use this. - /// - internal class FhirTypeConstants - { - // primitive types - public const string BOOLEAN = "boolean"; - public const string INTEGER = "integer"; - public const string INTEGER64 = "integer64"; - public const string UNSIGNED_INT = "unsignedInt"; - public const string POSITIVE_INT = "positiveInt"; - public const string TIME = "time"; - public const string DATE = "date"; - public const string INSTANT = "instant"; - public const string DATE_TIME = "dateTime"; - public const string DECIMAL = "decimal"; - public const string STRING = "string"; - public const string CODE = "code"; - public const string ID = "id"; - public const string URI = "uri"; - public const string OID = "oid"; - public const string UUID = "uuid"; - public const string CANONICAL = "canonical"; - public const string URL = "url"; - public const string MARKDOWN = "markdown"; - public const string BASE64_BINARY = "base64Binary"; - - // General-Purpose Data types - public const string CODING = "Coding"; - public const string CODEABLE_CONCEPT = "CodeableConcept"; - public const string QUANTITY = "Quantity"; - - // Special Purpose Data types - public const string EXTENSION = "Extension"; - public const string REFERENCE = "Reference"; - public const string CODEABLEREFERENCE = "CodeableReference"; - public const string XHTML = "xhtml"; - - // Resource type - public const string BUNDLE = "Bundle"; - } -} \ No newline at end of file diff --git a/src/Hl7.Fhir.Base/Model/FhirTypeNames.cs b/src/Hl7.Fhir.Base/Model/FhirTypeNames.cs index 63b6b1237..4d9c6546c 100644 --- a/src/Hl7.Fhir.Base/Model/FhirTypeNames.cs +++ b/src/Hl7.Fhir.Base/Model/FhirTypeNames.cs @@ -1,20 +1,53 @@ -namespace Hl7.Fhir.Model +namespace Hl7.Fhir.Model; + +internal static class FhirTypeNames { - internal class FhirTypeNames - { - public const string PATIENT_NAME = "Patient"; - public const string BINARY_NAME = "Binary"; - public const string EXTENSION_NAME = "Extension"; - public const string SIMPLEQUANTITY_NAME = "SimpleQuantity"; - public const string STRUCTUREDEFINITION_NAME = "StructureDefinition"; - public const string CONCEPTMAP_NAME = "ConceptMap"; - public const string CODESYSTEM_NAME = "CodeSystem"; - public const string NAMINGSYSTEM_NAME = "NamingSystem"; - public const string DOMAINRESOURCE_NAME = "DomainResource"; - public const string REFERENCE_NAME = "Reference"; - public const string ELEMENT_NAME = "Element"; - public const string STRING_NAME = "string"; - public const string MARKDOWN_NAME = "markdown"; + public const string BOOLEAN = "boolean"; + public const string INTEGER = "integer"; + public const string INTEGER64 = "integer64"; + public const string UNSIGNED_INT = "unsignedInt"; + public const string POSITIVE_INT = "positiveInt"; + public const string TIME = "time"; + public const string DATE = "date"; + public const string INSTANT = "instant"; + public const string DATE_TIME = "dateTime"; + public const string DECIMAL = "decimal"; + public const string STRING = "string"; + public const string CODE = "code"; + public const string ID = "id"; + public const string URI = "uri"; + public const string OID = "oid"; + public const string UUID = "uuid"; + public const string CANONICAL = "canonical"; + public const string URL = "url"; + public const string MARKDOWN = "markdown"; + public const string BASE64_BINARY = "base64Binary"; + + // General-Purpose Data types + public const string CODING = "Coding"; + public const string CODEABLE_CONCEPT = "CodeableConcept"; + public const string QUANTITY = "Quantity"; + + // Special Purpose Data types + public const string EXTENSION = "Extension"; + public const string REFERENCE = "Reference"; + public const string CODEABLEREFERENCE = "CodeableReference"; + public const string XHTML = "xhtml"; + + // Resource type + public const string BUNDLE = "Bundle"; + public const string PATIENT_NAME = "Patient"; + public const string BINARY_NAME = "Binary"; + public const string EXTENSION_NAME = "Extension"; + public const string SIMPLEQUANTITY_NAME = "SimpleQuantity"; + public const string STRUCTUREDEFINITION_NAME = "StructureDefinition"; + public const string CONCEPTMAP_NAME = "ConceptMap"; + public const string CODESYSTEM_NAME = "CodeSystem"; + public const string NAMINGSYSTEM_NAME = "NamingSystem"; + public const string DOMAINRESOURCE_NAME = "DomainResource"; + public const string REFERENCE_NAME = "Reference"; + public const string ELEMENT_NAME = "Element"; + public const string STRING_NAME = "string"; + public const string MARKDOWN_NAME = "markdown"; - } } \ No newline at end of file