///------------------------------------------------------------------------------------------------- /// <summary>Process the structure primitive type.</summary> /// /// <remarks>Gino Canessa, 8/12/2019.</remarks> /// /// <param name="sd"> The SD.</param> /// <param name="filename">Filename of the file.</param> ///------------------------------------------------------------------------------------------------- static void ProcessStructurePrimitiveType(fhir.StructureDefinition sd, string filename) { //Console.WriteLine($"Primitive: {sd.Name}:{GetJsonTypeFromStructure(sd)} - {filename}"); // **** add our type **** FhirTypeManager.ProcessSpreadsheetType(sd.Name, GetPrimitiveJsonTypeFromStructure(sd), sd.Description, true, filename); }
///------------------------------------------------------------------------------------------------- /// <summary>Process the primitive table.</summary> /// /// <remarks>Gino Canessa, 7/5/2019.</remarks> /// /// <param name="dt">The dt.</param> ///------------------------------------------------------------------------------------------------- static void ProcessPrimitiveTable(DataTable dt, string sourceFilename) { // **** grab the indexes of the columns we care about **** int ordinalName = dt.Columns["Data Type"].Ordinal; int ordinalType = dt.Columns["Json"].Ordinal; int ordinalComment = dt.Columns["Definition"].Ordinal; // **** iterate over the items in this table **** foreach (DataRow row in dt.Rows) { // **** grab our data **** string name = row[ordinalName].ToString(); string baseType = row[ordinalType].ToString(); string comment = row[ordinalComment].ToString(); FhirTypeManager.ProcessSpreadsheetType(name, baseType, comment, true, sourceFilename); } }
///------------------------------------------------------------------------------------------------- /// <summary>Process the restrictions table.</summary> /// /// <remarks>Gino Canessa, 7/10/2019.</remarks> /// /// <param name="dt"> The dt.</param> /// <param name="elementBaseName">Name of the element base.</param> /// <param name="isPrimitive"> True if is primitive, false if not.</param> /// <param name="sourceFilename"> Filename of the source file.</param> ///------------------------------------------------------------------------------------------------- static void ProcessRestrictionsTable( DataTable dt, string elementBaseName, bool isPrimitive, string sourceFilename ) { // **** grab the indexes of the columns we care about **** int ordinalName = dt.Columns["Name"].Ordinal; int ordinalComment = dt.Columns["Definition"].Ordinal; // **** iterate over the items in this table **** foreach (DataRow row in dt.Rows) { // **** grab our data **** string name = row[ordinalName].ToString(); string comment = row[ordinalComment].ToString(); // **** skip empty rows **** if (string.IsNullOrEmpty(name)) { continue; } // **** skip standard restrictions (not interested right now) **** if (name.Equals(elementBaseName, StringComparison.Ordinal)) { continue; } // **** make this a type **** FhirTypeManager.ProcessSpreadsheetType(name, elementBaseName, comment, isPrimitive, sourceFilename); } }
static void AddMissingTypes() { // TODO(ginoc): Remove once we find the actual definition of xhtml if (!FhirTypeManager.Exists("xhtml")) { FhirTypeManager.ProcessSpreadsheetType( "xhtml", "string", "WARN: xhtml is defined as string as a definition cannot be found!", true, "definition-file-not-found" ); } // TODO(ginoc): Remove once we find the actual definition of SimpleQuantity if (!FhirTypeManager.Exists("SimpleQuantity")) { FhirTypeManager.ProcessSpreadsheetType( "SimpleQuantity", "Quantity", "WARN: SimpleQuantity definition cannot be found!", false, "definition-file-not-found" ); } // TODO(ginoc): Remove once we find the actual definition of MoneyQuantity if (!FhirTypeManager.Exists("MoneyQuantity")) { FhirTypeManager.ProcessSpreadsheetType( "MoneyQuantity", "Quantity", "WARN: MoneyQuantity definition cannot be found!", false, "definition-file-not-found" ); } // TODO(ginoc): Remove once we find the actual definition of Logical if (!FhirTypeManager.Exists("Logical")) { FhirTypeManager.ProcessSpreadsheetType( "Logical", "Element", "WARN: Logical definition cannot be found!", false, "definition-file-not-found" ); } // TODO(ginoc): Remove once we find the actual definition of Structure (only seen in datatypes/actiondefinition.xml) if (!FhirTypeManager.Exists("Structure")) { FhirTypeManager.ProcessSpreadsheetType( "Structure", "Element", "WARN: Structure definition cannot be found!", false, "definition-file-not-found" ); } }