Exemplo n.º 1
0
        public ResourcesMaker(FileCleaner fc,
                              String resourceDir,
                              String pageDir,
                              String cacheDir)
        {
            const String fcn = "ResourcesMaker";

            Self = this;

            this.fc          = fc;
            this.resourceDir = resourceDir;
            this.pageDir     = pageDir;

            if (Directory.Exists(this.resourceDir) == false)
            {
                Directory.CreateDirectory(this.resourceDir);
            }

            if (Directory.Exists(this.pageDir) == false)
            {
                Directory.CreateDirectory(this.pageDir);
            }

            if (FhirStructureDefinitions.Self == null)
            {
                this.ConversionInfo(this.GetType().Name, fcn, $"Init'g 'FhirStructureDefinitions'");
                FhirStructureDefinitions.Create(cacheDir);
            }
        }
        public void D1_BuildACRFragments()
        {
            DateTime start = DateTime.Now;

            Trace.WriteLine("Starting D1_BuildAcrFragments");
            try
            {
                ResourcesMaker pc = new ResourcesMaker(this.fc,
                                                       this.acrFragmentsDir,
                                                       this.acrPageDir,
                                                       this.cacheDir);
                pc.StatusErrors   += this.StatusErrors;
                pc.StatusInfo     += this.StatusInfo;
                pc.StatusWarnings += this.StatusWarnings;
                pc.CreateAcrResources();
                if (pc.HasErrors)
                {
                    StringBuilder sb = new StringBuilder();
                    pc.FormatErrorMessages(sb);
                    Trace.WriteLine(sb.ToString());
                    Debug.Assert(false);
                }
            }
            catch (Exception err)
            {
                Trace.WriteLine(err.Message);
                Assert.IsTrue(false);
            }

            TimeSpan span = DateTime.Now - start;

            Trace.WriteLine($"Ending D1_BuildAcrFragments [{(Int32)span.TotalSeconds}]");
        }
Exemplo n.º 3
0
        public IntroDoc Description(params String[] lines)
        {
            CodeBlockNested d = CreateDescriptionBlock();

            d
            .AppendRaw($"<p>")
            .AppendRaw($"  <u style=\"font-size:large\">{Title()} Definition</u>")
            .AppendRaw($"</p>")
            ;
            String[] citedLines = ResourcesMaker.FormatUmls(lines.ToList(), true);
            WriteParagraphs(d, citedLines);
            return(this);
        }
        public void D4_BuildGraphics()
        {
            DateTime start = DateTime.Now;

            Trace.WriteLine("Starting D4_BuildGraphics");
            try
            {
                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.acrResourcesDir, "*.json");
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.AlwaysShowChildren = true;
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("ImagingContextExtension"),
                                                Path.Combine(this.acrGraphicsDir, "ImagingContextOverview.svg"));
                    }
                    {
                        FocusMapMaker focusMapMaker = new FocusMapMaker(this.fc,
                                                                        map,
                                                                        this.acrGraphicsDir,
                                                                        this.acrPageDir);
                        focusMapMaker.Create();
                    }
                }

                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.acrFragmentsDir, "*.json");

                    FragmentMapMaker fragmentMapMaker = new FragmentMapMaker(this.fc,
                                                                             map,
                                                                             this.acrGraphicsDir,
                                                                             this.pageTemplateDir);
                    fragmentMapMaker.Create(false);
                }
            }
            catch (Exception err)
            {
                Trace.WriteLine(err.Message);
                Assert.IsTrue(false);
            }

            TimeSpan span = DateTime.Now - start;

            Trace.WriteLine($"Ending D4_BuildGraphics [{(Int32)span.TotalSeconds}]");
        }
        public void B4_BuildGraphics()
        {
            DateTime start = DateTime.Now;

            Trace.WriteLine("Starting B4_BuildGraphics");
            try
            {
                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.resourcesDir, "*.json");
                    {
                        FocusMapMaker focusMapMaker = new FocusMapMaker(this.fc,
                                                                        map,
                                                                        this.graphicsDir,
                                                                        this.pageDir);
                        focusMapMaker.Create();
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.AlwaysShowChildren = true;
                        // resourceMapMaker.SvgEditor.RenderTestPoint = "Tumor Satellite";
                        String svgPath = Path.Combine(this.graphicsDir, "TotalProfile.svg");
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("BreastRadComposition"),
                                                svgPath);

                        // Create PNG Image from SVG-File
                        //var svgDoc = Svg.SvgDocument.Open(svgPath);
                        //svgDoc.AspectRatio = new SvgAspectRatio();
                        //svgDoc.ShapeRendering = SvgShapeRendering.Auto;

                        //String pngPath = Path.Combine(this.graphicsDir, "TotalProfile.png");
                        //Int32 dpi = 1;
                        //Int32 width = 2748 * dpi;
                        //Int32 height = 38028 * dpi;

                        //Bitmap bmp = svgDoc.Draw(width, height);
                        //bmp.Save(pngPath, ImageFormat.Png);
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("BreastRadComposition"),
                                                Path.Combine(this.graphicsDir, "ProfileOverview.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("MGFinding"),
                                                Path.Combine(this.graphicsDir, "MgFindings.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("MRIFinding"),
                                                Path.Combine(this.graphicsDir, "MRIFindings.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("NMFinding"),
                                                Path.Combine(this.graphicsDir, "NMFindings.svg"));
                    }
                    {
                        ResourceMapMaker resourceMapMaker = new ResourceMapMaker(this.fc, map);
                        resourceMapMaker.Create(ResourcesMaker.CreateUrl("USFinding"),
                                                Path.Combine(this.graphicsDir, "USFindings.svg"));
                    }
                }

                {
                    ResourceMap map = new ResourceMap();
                    map.AddDir(this.fragmentsDir, "*.json");

                    FragmentMapMaker fragmentMapMaker = new FragmentMapMaker(this.fc,
                                                                             map,
                                                                             this.graphicsDir,
                                                                             this.pageTemplateDir);
                    fragmentMapMaker.Create(true);
                }
            }
            catch (Exception err)
            {
                Trace.WriteLine(err.Message);
                Assert.IsTrue(false);
            }

            TimeSpan span = DateTime.Now - start;

            Trace.WriteLine($"Ending B4_BuildGraphics [{(Int32)span.TotalSeconds}]");
        }
Exemplo n.º 6
0
 public ConceptDef SetUMLS(String penId,
                           params String[] value)
 {
     this.umlsText = ResourcesMaker.FormatUmls(value.ToList(), false);
     return(this);
 }