Ejemplo n.º 1
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());
        }