Exemplo n.º 1
0
 public StructureDefinitionImporter(IObjectRepository tdb, string scheme, string authority)
 {
     this.tdb       = tdb;
     this.scheme    = scheme;
     this.authority = authority;
     this.implementationGuideType = DSTU2Helper.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 = DSTU2Helper.GetImplementationGuideType(this.tdb, true);
 }
        public FHIR2StructureDefinitionController(IObjectRepository tdb, HttpRequestMessage request = null)
        {
            this.tdb = tdb;

            // NOTE: This is for unit testing only
            if (request != null)
            {
                this.Request = request;
            }

            this.implementationGuideType = DSTU2Helper.GetImplementationGuideType(this.tdb, true);
        }
 public FHIR2ImplementationGuideController(IObjectRepository tdb)
 {
     this.tdb = tdb;
     this.implementationGuideType = DSTU2Helper.GetImplementationGuideType(this.tdb, true);
 }
Exemplo n.º 5
0
        public FhirValueSet Convert(ValueSet valueSet, SummaryType?summaryType = null)
        {
            var implementationGuides = (from tc in valueSet.Constraints
                                        join t in this.tdb.Templates on tc.TemplateId equals t.Id
                                        select t.OwningImplementationGuide);
            bool usedByPublishedIgs = implementationGuides.Count(y => y.PublishStatus != null && y.PublishStatus.Status == PublishStatus.PUBLISHED_STATUS) > 0;

            FhirValueSet fhirValueSet = new FhirValueSet()
            {
                Id          = valueSet.Id.ToString(),
                Name        = valueSet.Name,
                Status      = usedByPublishedIgs ? ConformanceResourceStatus.Active : ConformanceResourceStatus.Draft,
                Description = valueSet.Description,
                Url         = valueSet.GetIdentifier(ValueSetIdentifierTypes.HTTP)
            };

            if (summaryType == null || summaryType == SummaryType.Data)
            {
                var activeMembers = valueSet.GetActiveMembers(DateTime.Now);

                if (activeMembers.Count > 0)
                {
                    // Compose
                    var compose = new FhirValueSet.ValueSetComposeComponent();
                    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.ValueSetExpansionComponent();
                    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.ValueSetExpansionContainsComponent()
                        {
                            System  = DSTU2Helper.FormatIdentifier(vsMember.CodeSystem.Oid),
                            Code    = vsMember.Code,
                            Display = vsMember.DisplayName
                        };

                        expansion.Contains.Add(fhirMember);
                    }
                }
            }

            return(fhirValueSet);
        }