public static TabularMappingDefinition BuildMappingDefinition(TabularTable tabularTable, Dictionary <string, PropertiesGroup> propertiesGroups, int maxDepth) { TabularMappingDefinition result = new TabularMappingDefinition(tabularTable.Name) { ResourceType = tabularTable.ResourceType, Unrollpath = tabularTable.UnrollPath }; ResolveDefinitionNode(result.Root, tabularTable.Properties, propertiesGroups, new LinkedList <string>(), new HashSet <string>(), maxDepth); return(result); }
public Dictionary <string, (object valueObj, object typeObj)> ToTabular(ElementNode fhirElement, TabularMappingDefinition defination) { IEnumerable <(string name, object valueObj, object typeObj)> result = ToTabularInternal(fhirElement, defination.Root); Dictionary <string, (object valueObj, object typeObj)> output = result.ToDictionary(k => k.name, v => (v.valueObj, v.typeObj)); return(output); }
public IEnumerable <Dictionary <string, (object valueObj, object typeObj)> > ToTabular(Resource resource, TabularMappingDefinition defination) { ElementNode root = ElementNode.FromElement(resource.ToTypedElement()); if (string.IsNullOrEmpty(defination.Unrollpath)) { IEnumerable <(string name, object valueObj, object typeObj)> result = ToTabularInternal(root, defination.Root); Dictionary <string, (object valueObj, object typeObj)> output = result.ToDictionary(k => k.name, v => (v.valueObj, v.typeObj)); output[ReservedColumnName.ResourceId] = (resource.Id, FhirTypeNames.String); yield return(output); } else { foreach (var node in root.Select(defination.Unrollpath)) { IEnumerable <(string name, object valueObj, object typeObj)> result = ToTabularInternal(ElementNode.FromElement(node), defination.Root); Dictionary <string, (object valueObj, object typeObj)> output = result.ToDictionary(k => k.name, v => (v.valueObj, v.typeObj)); output[ReservedColumnName.RowId] = (IdGenerator(), FhirTypeNames.String); output[ReservedColumnName.ResourceId] = (resource.Id, FhirTypeNames.String); output[ReservedColumnName.FhirPath] = (node.Location, FhirTypeNames.String); output[ReservedColumnName.ParentPath] = (GetParentLocation(node), FhirTypeNames.String); yield return(output); } } }