示例#1
0
        private string GenerateHtml(ValueSetFile valuesetFile)
        {
            string displayName = valuesetFile.ValueSet.name.value;

            object[] content = GenerateContent(valuesetFile, displayName);

            string contentHtml = Html.Div(content.ToArray()).ToString(SaveOptions.DisableFormatting);

            return(Pages.Instance.GetPage(displayName, contentHtml, "0.1", DateTime.Now));
        }
示例#2
0
        public void Generate(ValueSetFile valuesetFile)
        {
            if (!_profileSet.ValueSetFiles.Contains(valuesetFile))
            {
                throw new ArgumentException("ValueSet does not exist in FhirXmlProfileSet", "valueset");
            }

            string html = GenerateHtml(valuesetFile);

            _outputPaths.WriteUtf8File(OutputFileType.Html, valuesetFile.OutputHtmlFilename, html);
        }
        // Kevin Mayfield Leeds Teaching Trust 23/1/2017 For procesing ValueSet in ConceptMap
        public ValueSet GetValueSet(string canonicalUrl)
        {
            ValueSetFile valueSetFile = _valueSets.SingleOrDefault(t => t.CanonicalUrl == canonicalUrl);

            if (valueSetFile != null)
            {
                return(valueSetFile.ValueSet);
            }

            ValueSet valueSet = FhirData.Instance.FindValueSet(canonicalUrl);

            if (valueSet == null)
            {
                throw new Exception("ValueSet " + canonicalUrl + " not found.");
            }

            return(valueSet);
        }
        public Link GetValueSetLink(string canonicalUrl)
        {
            ValueSetFile valueSetFile = _valueSets.SingleOrDefault(t => t.CanonicalUrl == canonicalUrl);

            if (valueSetFile != null)
            {
                return(valueSetFile.Link);
            }

            ValueSet valueSet = FhirData.Instance.FindValueSet(canonicalUrl);

            if (valueSet == null)
            {
                throw new Exception("ValueSet " + canonicalUrl + " not found.");
            }

            return(new Link
                   (
                       url: valueSet.url.value,
                       display: valueSet.name.value
                   ));
        }
示例#5
0
        private object[] GenerateContent(ValueSetFile valuesetFile, string displayName)
        {
            List <object> content = new List <object>();

            ValueSet valueset = valuesetFile.ValueSet;

            string name = valueset.name.value;
            string url  = valueset.url.value;

            content.AddRange(new object[]
            {
                Html.H3(GetValueSetNameLabel(name)),
                Html.P("The official URL for this value set is: "),
                Html.Pre(url),
                Html.H3("Version"),
                Html.P(valuesetFile.VersionNumber)
            });

            string description  = valueset.description.WhenNotNull(t => t.value);
            string referenceUrl = valueset.GetExtensionValueAsString(FhirConstants.ValueSetSourceReferenceExtensionUrl);
            string oid          = valueset.GetExtensionValueAsString(FhirConstants.ValueSetOidExtensionUrl);

            if ((!string.IsNullOrWhiteSpace(description)) || (!string.IsNullOrWhiteSpace(referenceUrl)) || (!string.IsNullOrWhiteSpace(oid)))
            {
                content.AddRange(new object[]
                {
                    Html.H3("Description"),
                    GetFormattedDescription(description, referenceUrl, oid)
                });
            }

            string requirements = valueset.requirements.WhenNotNull(t => t.value);

            if (!string.IsNullOrWhiteSpace(requirements))
            {
                content.AddRange(new object[]
                {
                    Html.P(requirements)
                });
            }

            content.AddRange(new object[]
            {
                Html.H3("Definition"),
                GenerateDefinition(valueset)
            });

            /*if (CanExpand(valueset))
             * {
             *  content.AddRange(new object[]
             *  {
             *      Html.H3("Code expansion"),
             *      Html.P("Expansion generated on " + DateTime.Now.ToString("dd-MMM-yyyy") + ".  Please check the source code system(s) for the most recent data."),
             *      GenerateCodeExpansion(valueset)
             *  });
             * }*/

            string copyright = valueset.copyright.WhenNotNull(t => t.value);

            if (!string.IsNullOrEmpty(copyright))
            {
                content.AddRange(new object[]
                {
                    Html.H3("Copyright"),
                    Html.P(copyright)
                });
            }

            content.AddRange(new object[]
            {
                Html.H3("Schemas"),
                StructureDefinitionHtmlGenerator.GetSchemasList(new object[]
                {
                    Html.A(_outputPaths.GetRelativePath(OutputFileType.ValueSet, valuesetFile.OutputXmlFilename), "Value set XML"),
                    Html.A(_outputPaths.GetRelativePath(OutputFileType.ValueSet, valuesetFile.OutputJsonFilename), "Value set JSON")
                })
            });

            return(content.ToArray());
        }