/// <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)); }
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); }
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); } }
/// <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); }
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); }
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); }
public ElementTreeLoader(IConversionInfo info = null) { this.info = info; }
public SDefCleaner(IConversionInfo info) { this.conversionInfo = info; }
public ElementTreeSetBase(IConversionInfo info) { this.info = info; }
public ElementTreeDiffer(IConversionInfo info) { this.info = info; }