Пример #1
0
        void ProcessProfile(StructureDefinition profile)
        {
            String fcn = nameof(ProcessProfile);

            try
            {
                if (profile.Snapshot == null)
                {
                    SnapshotCreator.Create(profile);
                }
                ElementDefinitionNode profileItems = ElementDefinitionNode.Create(profile);

                String baseFhirResourceName = profile.Type;
                Type   fhirType             = ModelInfo.GetTypeForFhirType(baseFhirResourceName);
                if (fhirType == null)
                {
                    throw new Exception($"Can not find Fhir Resource Class for '{baseFhirResourceName}'");
                }

                String name = $"{profile.Name}Extensions";

                GenerateItem gi = new GenerateItem(this,
                                                   this.NameSpace,
                                                   name,
                                                   profile.Type,
                                                   fhirType,
                                                   this.OutputLanguage,
                                                   profileItems);

                gi.Process();

                if (this.SaveFlag == true)
                {
                    String outputFile = Path.Combine(this.OutputDir, $"{name}.cs");
                    File.WriteAllText(outputFile, gi.GetCode());
                }
            }
            catch (Exception err)
            {
                this.ConversionError(this.GetType().Name, fcn, $"Profile {profile.Name} failed with exception {err.Message}");
            }
        }
Пример #2
0
 public SDefInfo(StructureDefinition sDef)
 {
     this.SDef             = sDef;
     ElementDefinitionNode = ElementDefinitionNode.Create(sDef);
 }