Esempio n. 1
0
        /// <summary>
        /// Create structure definition editor
        /// </summary>
        public SDefEditor(IConversionInfo info,
                          String name,
                          String url,
                          String baseDefinition,
                          String mapName,
                          String fragmentDir,
                          String pageDir)
        {
            this.info        = info;
            this.fragmentDir = fragmentDir;
            this.pageDir     = pageDir;
            this.baseSDef    = FhirStructureDefinitions.Self.GetResource(baseDefinition);
            if (this.baseSDef == null)
            {
                throw new Exception($"'Base definition resource {baseDefinition}' not found");
            }

            this.basePath = baseDefinition.LastUriPart();

            {
                ElementTreeLoader l = new ElementTreeLoader();
                this.snapNode         = l.Create(this.baseSDef.Snapshot.Element);
                this.snapNodeOriginal = this.snapNode.Clone();
            }

            this.sDef = new StructureDefinition
            {
                Name           = name,
                Url            = url,
                BaseDefinition = baseDefinition,
                Differential   = new StructureDefinition.DifferentialComponent()
            };

            this.SDef.AddExtension(Global.ResourceMapNameUrl, new FhirString(mapName));
        }
Esempio n. 2
0
        public ExcelData(IConversionInfo converter,
                         String filePath,
                         String sheetName)
        {
            this.converter = converter;
            this.filePath  = filePath;
            DataSet   dataSet       = this.ReadSpreadSheet(filePath);
            DataTable originalTable = dataSet.Tables[sheetName];

            this.dataTable = CreateTableWithHeadings(originalTable);
            this.LoadRows(originalTable);
        }
Esempio n. 3
0
        public ProcessItem(IConversionInfo info, DomainResource resource)
        {
            this.info     = info;
            this.Resource = resource;

            // Load incompatible extensions.
            foreach (Extension extension in resource.GetExtensions(PreFhirGenerator.IncompatibleFragmentUrl))
            {
                FhirUrl imcompatibleUrl = (FhirUrl)extension.Value;
                this.incompatibleFragments.Add(imcompatibleUrl.Value);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Check if item is compatible.
        /// </summary>
        public bool CheckCompatible(ProcessItem mergeItem,
                                    IConversionInfo conversionInfo)
        {
            const String fcn = "CheckCompatible";

            bool retVal = true;

            if (DoCheckCompatible(mergeItem, conversionInfo) == false)
            {
                conversionInfo.ConversionError(this.GetType().Name,
                                               fcn,
                                               $"    {this.Resource.GetUrl()}.");
                return(false);
            }

            return(retVal);
        }
Esempio n. 5
0
        public SDInfo(IConversionInfo ci, StructureDefinition sd)
        {
            this.StructDef = sd;
            ElementTreeLoader l = new ElementTreeLoader(ci);

            if (sd.Snapshot == null)
            {
                SnapshotCreator.Create(sd);
            }

            this.DiffNodes = l.Create(sd.Differential.Element);
            this.SnapNodes = l.Create(sd.Snapshot.Element);

            this.InterfaceEditor = new CodeEditor();
            this.InterfaceEditor.TryAddUserMacro("ClassName", CS.CSMisc.ClassName(this));
            this.InterfaceEditor.TryAddUserMacro("InterfaceName", CS.CSMisc.InterfaceName(this));
            this.InterfaceEditor.Load(Path.Combine("Templates", "Interface.txt"));
            this.AddMacros(this.InterfaceEditor, this);

            this.SubClassEditor = new CodeEditor();
            this.AddMacros(this.SubClassEditor, this);
            this.SubClassEditor.TryAddUserMacro("FhirBase", this.StructDef.BaseDefinition.LastUriPart());
            this.SubClassEditor.TryAddUserMacro("BaseClass", CS.CSMisc.ClassName(this));
            this.SubClassEditor.Load(Path.Combine("Templates", "SubClass.txt"));

            this.ClassEditor = new CodeEditor();
            this.AddMacros(this.ClassEditor, this);
            this.ClassEditor.TryAddUserMacro("ClassName", CS.CSMisc.ClassName(this));
            if (this.IsFragment())
            {
                this.ClassEditor.Load(Path.Combine("Templates", "Fragment.txt"));
            }
            else
            {
                this.ClassEditor.Load(Path.Combine("Templates", "Class.txt"));
            }

            this.CodeBlocks = ClassCodeBlocks.Create(this.InterfaceEditor,
                                                     this.ClassEditor,
                                                     this.SubClassEditor);
        }
Esempio n. 6
0
        bool DoCheckCompatible(ProcessItem mergeItem,
                               IConversionInfo conversionInfo)
        {
            const String fcn = "CheckCompatible";

            if (this.incompatibleFragments.Contains(mergeItem.Resource.GetUrl()))
            {
                conversionInfo.ConversionError(this.GetType().Name,
                                               fcn,
                                               $"Fragment {mergeItem.Resource.GetUrl()} is not compatible with {this.Resource.GetUrl()}.");
                return(false);
            }

            foreach (ProcessItem includedFragment in this.includedFragments)
            {
                if (includedFragment.CheckCompatible(mergeItem, conversionInfo) == false)
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 7
0
 public ElementTreeLoader(IConversionInfo info = null)
 {
     this.info = info;
 }
Esempio n. 8
0
 public SDefCleaner(IConversionInfo info)
 {
     this.conversionInfo = info;
 }
Esempio n. 9
0
 public ElementTreeSetBase(IConversionInfo info)
 {
     this.info = info;
 }
Esempio n. 10
0
 public ElementTreeDiffer(IConversionInfo info)
 {
     this.info = info;
 }