public StructureDefinitionImporter(IObjectRepository tdb, string scheme, string authority) { this.tdb = tdb; this.scheme = scheme; this.authority = authority; this.implementationGuideType = STU3Helper.GetImplementationGuideType(this.tdb, true); }
/// <summary> /// Initializes a new instance of ImplementationGuideExporter /// </summary> /// <param name="tdb">Reference to the database</param> /// <param name="scheme">The server url's scheme</param> /// <param name="authority">The server url's authority</param> public ImplementationGuideExporter(IObjectRepository tdb, SimpleSchema schema, string scheme, string authority) { this.tdb = tdb; this.scheme = scheme; this.authority = authority; this.schema = schema; this.implementationGuideType = STU3Helper.GetImplementationGuideType(this.tdb, true); }
public FHIR3StructureDefinitionController(IObjectRepository tdb, HttpRequestMessage request = null) { Log.For(this).Trace("Instantiating controller"); this.tdb = tdb; // NOTE: This is for unit testing only if (request != null) { this.Request = request; } this.implementationGuideType = STU3Helper.GetImplementationGuideType(this.tdb, true); Log.For(this).Trace("Done instantiating controller"); }
public FHIR3ImplementationGuideController(IObjectRepository tdb) { this.tdb = tdb; this.implementationGuideType = STU3Helper.GetImplementationGuideType(this.tdb, true); }
/// <summary> /// Converts a Trifolia ValueSet model to a FHIR ValueSet model. /// </summary> /// <param name="valueSet">The Trifolia ValueSet model to convert to a FHIR model</param> /// <param name="summaryType">Does not populate certain fields when a summaryType is specified.</param> /// <param name="publishedValueSets">Optional list of ValueSets that are used by a published implementation guide. If not specified, queries the database for implementation guides that this value set may be published under.</param> /// <returns>A FHIR ValueSet model</returns> public FhirValueSet Convert(ValueSet valueSet, SummaryType?summaryType = null, IEnumerable <ValueSet> publishedValueSets = null) { bool usedByPublishedIgs = false; if (publishedValueSets == null) { var implementationGuides = (from tc in valueSet.Constraints join t in this.tdb.Templates on tc.TemplateId equals t.Id select t.OwningImplementationGuide); usedByPublishedIgs = implementationGuides.Count(y => y.PublishStatus != null && y.PublishStatus.IsPublished) > 0; } else { usedByPublishedIgs = publishedValueSets.Contains(valueSet); } FhirValueSet fhirValueSet = new FhirValueSet() { Id = valueSet.GetFhirId(), Name = valueSet.Name, Status = usedByPublishedIgs ? ConformanceResourceStatus.Active : ConformanceResourceStatus.Draft, Description = new Markdown(valueSet.Description), Url = valueSet.Oid }; if (summaryType == null || summaryType == SummaryType.Data) { var activeMembers = valueSet.GetActiveMembers(DateTime.Now); if (activeMembers.Count > 0) { // Compose var compose = new FhirValueSet.ComposeComponent(); fhirValueSet.Compose = compose; foreach (var groupedMember in activeMembers.GroupBy(y => y.CodeSystem, y => y)) { var include = new FhirValueSet.ConceptSetComponent(); compose.Include.Add(include); include.System = groupedMember.Key.Oid; foreach (var member in groupedMember) { include.Concept.Add(new FhirValueSet.ConceptReferenceComponent() { Code = member.Code, Display = member.DisplayName }); } } // Expansion var expansion = new FhirValueSet.ExpansionComponent(); expansion.Identifier = string.Format("urn:uuid:{0}", Guid.NewGuid()); expansion.Timestamp = FhirDateTime.Now().ToString(); fhirValueSet.Expansion = expansion; foreach (ValueSetMember vsMember in activeMembers) { var fhirMember = new FhirValueSet.ContainsComponent() { System = STU3Helper.FormatIdentifier(vsMember.CodeSystem.Oid), Code = vsMember.Code, Display = vsMember.DisplayName }; expansion.Contains.Add(fhirMember); } } } return(fhirValueSet); }