Esempio n. 1
0
        private void ConvertStructureDefinition(TargetModel.StructureDefinition to, SourceModel.StructureDefinition from, FhirConverter converter)
        {
            to.FhirVersionElement = new Id("3.0.2")
            {
                Extension = converter.ConvertList <Extension, Extension>(from.FhirVersionElement?.Extension).ToList()
            };

            var contextTypeElement = from.Context?.FirstOrDefault()?.TypeElement;

            to.ContextTypeElement = converter.ConvertElement <Code <TargetModel.StructureDefinition.ExtensionContext>, Code <SourceModel.StructureDefinition.ExtensionContextType> >(contextTypeElement);
            to.ContextElement     = from.Context.Select(context =>
                                                        converter.ConvertElement <FhirString, FhirString>(context.ExpressionElement)
                                                        ).ToList();

            to.TypeElement = ConvertFhirUriToCode(from.TypeElement, converter);

            to.BaseDefinitionElement = ConvertCanonicalToFhirUri(from.BaseDefinitionElement, converter);
        }
        private static void ConvertStructureDefinition(TargetModel.StructureDefinition to, SourceModel.StructureDefinition from, FhirConverter converter)
        {
            // StructureDefinition.fhirVersion
            to.FhirVersionElement = new Code <TargetModel.FHIRVersion>(TargetModel.FHIRVersion.N4_0_0)
            {
                Extension = converter.ConvertList <Extension, Extension>(from.FhirVersionElement?.Extension).ToList()
            };

            // StructureDefinition.context
            to.Context = from.ContextElement.Select(contextElement =>
                                                    new TargetModel.StructureDefinition.ContextComponent
            {
                TypeElement       = converter.ConvertElement <Code <TargetModel.StructureDefinition.ExtensionContextType>, Code <SourceModel.StructureDefinition.ExtensionContext> >(from.ContextTypeElement),
                ExpressionElement = converter.ConvertElement <FhirString, FhirString>(contextElement)
            }
                                                    ).ToList();

            // StructureDefinition.type
            to.TypeElement = ConvertCodeToFhirUri(from.TypeElement, converter);

            // StructureDefinition.baseDefinition
            to.BaseDefinitionElement = ConvertFhirUriToCanonical(from.BaseDefinitionElement, converter);
        }