Пример #1
0
        public async Task <ActionResult <TestResultGroup> > PostTestResultGroup(TestResultGroup testResultGroup)
        {
            _context.TestResultGroups.Add(testResultGroup);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTestResultGroup", new { id = testResultGroup.Id }, testResultGroup));
        }
Пример #2
0
        public async Task <IActionResult> PutTestResultGroup(int id, TestResultGroup testResultGroup)
        {
            if (id != testResultGroup.Id)
            {
                return(BadRequest());
            }

            _context.Entry(testResultGroup).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TestResultGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 internal GroupByClassTestsPage(TestResultGroup tests)
 {
     InitializeComponent();
     this.tests                     = tests;
     list.ItemsSource               = new List <TestResultGroup>(tests.GroupBy(t => t.ClassName).Select((g, t) => new TestResultGroup(g.Key.StartsWith(tests.Group + ".") ? g.Key.Substring(tests.Group.Length + 1) : g.Key, g)).OrderBy(g => g.Group));
     this.BindingContext            = tests;
     currentTestView.BindingContext = TestRunnerVM.Instance;
 }
Пример #4
0
        [HttpPost] //TODO: BTW I remember deleting one of these things to do something hacky, idk where but you should make sure to put them back... -Nathan
        public async Task <IActionResult> AddTestGroup(int testGroupId, int patientId)
        {
            var patient = await _context.Patients.FindAsync(patientId);

            TestResultGroup trg = new TestResultGroup();

            trg.TestGroupInfo = await _context.TestGroups.FindAsync(testGroupId);

            patient.ResultGroups.Add(trg);

            if (ModelState.IsValid)
            {
                _context.Add(trg);
                await _context.SaveChangesAsync();
            }
            return(Redirect("Edit/" + patientId));
        }
Пример #5
0
        private Table CreateSubTable(TestResultGroup testResultGroup)
        {
            int numResults = testResultGroup.Tests.Count();

            Table table = new Table();

            // Append the TableProperties object to the empty table.
            table.AppendChild <TableProperties>(WordTableFormats.SubTableFormat());


            // Create a row.
            int      cellHeight = 375;
            TableRow tr         = new TableRow(new TableRowProperties(new TableRowHeight()
            {
                Val = Convert.ToUInt32(cellHeight)
            }));
            TableCell testName = new TableCell(WordTableFormats.LabelCellFormat(),
                                               new Paragraph(new Run(new RunProperties(new RunFonts()
            {
                Ascii = "Times New Roman"
            }, new Bold(), new FontSize()
            {
                Val = "24"
            }),
                                                                     new Text("Tests"))));
            TableCell zScore = new TableCell(WordTableFormats.LabelCellFormat(),
                                             new Paragraph(new Run(new RunProperties(new RunFonts()
            {
                Ascii = "Times New Roman"
            }, new Bold(), new FontSize()
            {
                Val = "24"
            }),
                                                                   new Text("StandardizedScore"))));
            TableCell percentile = new TableCell(WordTableFormats.LabelCellFormat(),
                                                 new Paragraph(new Run(new RunProperties(new RunFonts()
            {
                Ascii = "Times New Roman"
            }, new Bold(), new FontSize()
            {
                Val = "24"
            }),
                                                                       new Text("Percentile"))));

            tr.Append(testName, zScore, percentile);
            table.AppendChild(tr);


            foreach (TestResult result in testResultGroup.Tests)
            {
                tr = new TableRow(new TableRowProperties(new TableRowHeight()
                {
                    Val = Convert.ToUInt32(cellHeight)
                }));
                testName = new TableCell(WordTableFormats.DataCellFormat(),
                                         new Paragraph(new Run(new Text(result.Test.Name))));
                zScore = new TableCell(WordTableFormats.DataCellFormat(),
                                       new Paragraph(new Run(new Text(result.StandardizedScore.ToString()))));
                percentile = new TableCell(WordTableFormats.DataCellFormat(),
                                           new Paragraph(new Run(new Text(result.Percentile.ToString()))));
                tr.AppendChild(testName); tr.AppendChild(zScore); tr.AppendChild(percentile);
                table.AppendChild(tr);
            }

            return(table);
        }
Пример #6
0
 private void DisplayTestGroup(TestResultGroup testResultGroup)
 {
     WordDoc.MainDocumentPart.Document.Body.Append(CreateTitleTable(testResultGroup.TestGroupInfo.Name));
     LineBreak();
     WordDoc.MainDocumentPart.Document.Body.Append(CreateSubTable(testResultGroup));
 }
Пример #7
0
 internal TestRunPage(TestResultGroup testCases)
 {
     InitializeComponent();
     this.BindingContext            = testCases;
     currentTestView.BindingContext = TestRunnerVM.Instance;
 }
Пример #8
0
        public static Stream MakePatientPercentileChart(TestResultGroup testResultGroup)
        {
            var entries = new List <Entry>();

            int[]  green  = new int[] { 0, 255, 0 };
            int[]  yellow = new int[] { 255, 255, 0 };
            int[]  red    = new int[] { 255, 0, 0 };
            double interp;
            string hexcol;
            int    percentile;

            foreach (TestResult result in testResultGroup.Tests)
            {
                interp = 0.01 * result.Percentile;
                if (interp < 0.5)
                {
                    hexcol = ColToHex(LinearInterpolation(red, yellow, 2 * interp));
                }
                else
                {
                    hexcol = ColToHex(LinearInterpolation(yellow, green, 2 * (interp - 0.5)));
                }
                if (Math.Abs(result.Percentile) < 1)
                {
                    percentile = 1;
                }
                else
                {
                    percentile = (int)result.Percentile;
                }
                entries.Add(new Entry(percentile)
                {
                    Label      = result.Test.Name,
                    ValueLabel = result.Percentile.ToString(),
                    Color      = SKColor.Parse(hexcol)
                });
            }

            var chart = new BarChart()
            {
                Entries          = entries,
                MaxValue         = 100,
                MinValue         = 0,
                LabelOrientation = Microcharts.Orientation.Vertical
            };

            int width  = entries.Count * 50;
            int height = 600;

            SKImageInfo info    = new SKImageInfo(width, height);
            SKSurface   surface = SKSurface.Create(info);

            SKCanvas canvas = surface.Canvas;

            chart.Draw(canvas, width, height);

            Stream imageStream = new MemoryStream();

            // create an image and then get the PNG (or any other) encoded data
            using (var data = surface.Snapshot().Encode(SKEncodedImageFormat.Png, 80)) {
                // save the data to a stream
                data.SaveTo(imageStream);
            }

            imageStream = RotateImage(imageStream);

            return(imageStream);
        }