Exemplo n.º 1
0
        private string GenerateHtml(ResourceFileSet resourceFileSet, OutputPaths outputPaths, OutputOptions outputOptions)
        {
            // copy supporting files
            Styles.WriteStylesToDisk(outputPaths);
            Images.WriteImagesToDisk(outputPaths);
            Scripts.WriteScriptsToDisk(outputPaths);

            // structure definition pages
            StructureDefinitionHtmlGenerator structureDefinitionGenerator = new StructureDefinitionHtmlGenerator(resourceFileSet, outputPaths);

            structureDefinitionGenerator.GenerateAll();

            // valueset pages
            ValueSetHtmlGenerator valuesetGenerator = new ValueSetHtmlGenerator(resourceFileSet, outputPaths);

            valuesetGenerator.GenerateAll();

            // Kevin Mayfield Leeds Teaching Trust 23/1/2017 added ConceptMap
            // conceptmap pages
            ConceptMapHtmlGenerator conceptMapGenerator = new ConceptMapHtmlGenerator(resourceFileSet, outputPaths);

            conceptMapGenerator.GenerateAll();

            if (outputOptions.ShowEverythingOnOnePage)
            {
                ResourceListingHtmlGenerator resourceListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateSingleResourceListingPageWithIntroText("index.html", resourceFileSet, outputOptions.IndexPageHtml);
            }
            else
            {
                ResourceListingHtmlGenerator resourceListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateStructureDefinitionListing("resources.html", resourceFileSet);

                ResourceListingHtmlGenerator valueSetsListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateValueSetListing("valuesets.html", resourceFileSet);

                // Kevin Mayfield Leeds Teaching Trust 23/1/2017 added ConceptMap
                ResourceListingHtmlGenerator conceptMapsListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateConceptMapListing("conceptmaps.html", resourceFileSet);

                GenericPageGenerator pageGenerator = new GenericPageGenerator(outputPaths);
                pageGenerator.Generate("index.html", "Overview", outputOptions.IndexPageHtml);

                pageGenerator.Generate("api.html", "API", GetApiPageContent());
            }

            // profile xml and json files
            SourceFileManager sourceGenerator = new SourceFileManager(outputPaths, resourceFileSet);

            sourceGenerator.CopyXml();
            sourceGenerator.GenerateJson();
            sourceGenerator.CreateRedirectsForProfileUrls();

            return(outputPaths.GetOutputPath(OutputFileType.Html, "index.html"));
        }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
0
        private object[] GenerateContent(ConceptMapFile conceptMapFile, string displayName)
        {
            List <object> content = new List <object>();

            ConceptMap conceptMap = conceptMapFile.ConceptMap;

            string name = conceptMap.name.value;

            string url = "";

            if (conceptMap.url != null)
            {
                url = conceptMap.url.value;
            }

            content.AddRange(new object[]
            {
                Html.H3(GetConceptMapNameLabel(name)),
                Html.P("The official URL for this value set is: "),
                Html.Pre(url),
                Html.P(GetMaturity(conceptMapFile.Maturity)),
            });

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

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

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


            string copyright = conceptMap.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.ConceptMap, conceptMapFile.OutputXmlFilename), "ConceptMap XML"),
                    Html.A(_outputPaths.GetRelativePath(OutputFileType.ConceptMap, conceptMapFile.OutputJsonFilename), "ConceptMap JSON")
                })
            });

            return(content.ToArray());
        }