Ejemplo n.º 1
0
        protected void PrintIntroPage(PdfOutput output)
        {
            output.drawY = PdfOutput.pageHeight - .52;
            output.appendWrappedText("Introduction to the SIS Report:", .36, 7.9, output.boldFont);

            output.drawY = PdfOutput.pageHeight - .73;
            output.appendWrappedText(ReplaceSISReservedWords(
                                         "The Supports Intensity Scale [Adult_Child] Version ([SIS-A_SIS-C]) profile information is " +
                                         "designed to assist in the service planning process for the individual, " +
                                         "their parents, family members, and service providers. The profile " +
                                         "information outlines the type and intensity of support the individual " +
                                         "would benefit from to participate and be successful in his or her " +
                                         "community. The [SIS-A_SIS-C] profile report is best applied in combination with " +
                                         "person-centered planning to achieve the desired outcome in creating individual goals."),
                                     .36, 7.9);

            output.drawY = PdfOutput.pageHeight - 1.25;

            if (form.identifier == "SIS-A")
            {
                AppendPartHeader(output, "Rating Key for Sections 2 and 3");
            }
            else
            {
                AppendPartHeader(output, "Rating Key for Section 2");
            }

            output.drawY = PdfOutput.pageHeight - 1.56;
            output.appendWrappedText(ReplaceSISReservedWords(
                                         "This describes the rating for Type of Support, Frequency " +
                                         "and Daily Support time for each of the six areas discussed in your [SIS-A_SIS-C] profile"),
                                     .36, 7.9);

            //table headers
            output.drawY = PdfOutput.pageHeight - 1.99;
            output.appendWrappedText("Type of Support", .5, 7.9);
            output.drawY = PdfOutput.pageHeight - 1.99;
            output.appendWrappedText("Frequency", 3.5, 7.9);
            output.drawY = PdfOutput.pageHeight - 1.99;
            output.appendWrappedText("Daily Support Time", 6.08, 7.9);

            //first column of text
            double[] firstColumnDy   = { 2.4, 2.87, 3.56, 4.17, 4.34, 4.68, 4.85, 5.02, 5.19, 5.36, 5.53, 5.87, 6.04, 6.21, 6.38, 6.55, 6.72, 7.06, 7.23, 7.40, 7.57, 7.74, 8.08, 8.25, 8.42 };
            string[] firstColumnText =
            {
                "What help do you need to do the (item) on your own or by yourself",
                "If engaged in the activity over the next several months, what would the nature of the support look like?",
                "Which support type dominates the support provided?",

                "0 = None",
                "No support needed at any time",

                "1 = Monitoring (reminders). For example",
                "* Encouragement, general supervision",
                "* Checking in, observing, telling, &/or giving",
                "  reminders to complete the activity",
                "* Asking questions to trigger the individual to",
                "  complete steps within the activity",

                "2 = Verbal/Gesture Prompting (demonstration). For",
                "example:",
                "* Step by step instruction",
                "  Walking a person through required steps",
                "* Providing visual prompts, showing",
                "* Modeling, teaching, role play, social stories",

                "3 = Partial Physical Assistance (help through)",
                "doing). For example:",
                "* Individual participates in some parts of the activity",
                "* Some, essential steps are required to be",
                " completed for the person",

                "4 = Full Physical Support (doing for). For example:",
                "* All essential steps need to be completed for the",
                "  person"
            };

            for (int i = 0; (i < firstColumnDy.Length) && (i < firstColumnText.Length); i++)
            {
                output.drawY = PdfOutput.pageHeight - firstColumnDy[i];
                output.appendWrappedText(firstColumnText[i], .5, 2.7, firstColumnText[i].Contains("=") ? output.boldFont : output.contentFont);
            }

            //Build SIS-A frequency second column
            double[] secondColumnDySisA   = { 2.4, 4.17, 4.83, 5.5, 6.17, 7 };
            string[] secondColumnTextSisA =
            {
                "How frequently is supported needed for this activity?",
                "0 = None or less than monthly",
                "1 = At least once a month, but not once a week",
                "2 = At least once a week, but not once a day",
                "3 = At least once a day, But not once an hour",
                "4 = Hourly or more frequently"
            };

            //Build SIS-C frequency second column
            double[] secondColumnDySisC   = { 2.4, 4.17, 4.83, 5.5, 6.17, 6.84 };
            string[] secondColumnTextSisC =
            {
                "Frequency of Support",
                "0 = Negligible; the child's support needs are rarely if ever different from those of same-aged peers in regard to frequency.",
                "1 = Infrequently; the child will occasionally need someone to provide extraordinary support that same-aged peers will not need.",
                "2 = Frequently; in order for the child to participate in the activity, extra support will need to be provided for about half of the occurrences of the activity.",
                "3 = Very Frequently; in most occurrences of the activity, the child will need extra support that same-aged peers will not need.",
                "4 = Always; on every occasion that the child participates in the activity, the child will need extra support that same aged peers will not need. "
            };

            // Write out SIS-A frequency column
            if (form.identifier.Equals("SIS-A"))
            {
                for (int i = 0; (i < secondColumnDySisA.Length) && (i < secondColumnTextSisA.Length); i++)
                {
                    output.drawY = PdfOutput.pageHeight - secondColumnDySisA[i];
                    output.appendWrappedText(secondColumnTextSisA[i], 3.5, 2.2, secondColumnTextSisA[i].Contains("=") ? output.boldFont : output.contentFont);
                }
            }

            // Write out SIS-C frequency column
            if (form.identifier.Equals("SIS-C"))
            {
                for (int i = 0; (i < secondColumnDySisC.Length) && (i < secondColumnTextSisC.Length); i++)
                {
                    output.drawY = PdfOutput.pageHeight - secondColumnDySisC[i];
                    output.appendWrappedText(secondColumnTextSisC[i], 3.5, 2.2, secondColumnTextSisC[i].Contains("=") ? output.boldFont : output.contentFont);
                }
            }

            //third column of text
            double[] thirdColumnDy   = { 2.4, 4.17, 4.67, 5.17, 5.83, 6.33 };
            string[] thirdColumnText =
            {
                "If engaged in the activity over the next several months, in a typical 24-hour day, "
                + "how much total, cumulative time would be needed to provide support?",
                "0 = None",
                "1 = Less Than 30 Minutes",
                "2 = 30 Minutes to Less Than 2 Hours",
                "3 = 2 Hours to Less Than 4 Hours",
                "4 = 4 Hours or More"
            };

            for (int i = 0; (i < thirdColumnDy.Length) && (i < thirdColumnText.Length); i++)
            {
                output.drawY = PdfOutput.pageHeight - thirdColumnDy[i];
                output.appendWrappedText(thirdColumnText[i], 6.08, 1.92, thirdColumnText[i].Contains("=") ? output.boldFont : output.contentFont);
            }


            //horizontal lines
            foreach (double dy in new double[] { 1.82, 2.25, 3.99, 8.93 })
            {
                output.DrawLine(.36, PdfOutput.pageHeight - dy, 8.12, PdfOutput.pageHeight - dy, .02);
            }

            //vertical lines
            foreach (double x in new double[] { .36, 3.35, 5.93, 8.12 })
            {
                output.DrawLine(x, PdfOutput.pageHeight - 1.82, x, PdfOutput.pageHeight - 8.93, .02);
            }
        }
Ejemplo n.º 2
0
        protected void PrintSupportNeedsGraph(PdfOutput output, int ageInYears)
        {
            Debug.WriteLine("PrintSupportNeedsGraph() method.");

            new Assessments(formsRepo).UpdateAssessmentScores(formResults);

            def_Parts prt = formsRepo.GetPartByFormAndIdentifier(form, "Section 2. Supports Needs Index");

            formsRepo.GetPartSections(prt);
            int row = 0, nRows = prt.def_PartSections.Count();

            double[]      percentiles       = new double[nRows];
            string[][]    supNeedsTableVals = new string[nRows][];
            List <string> subscaleLabels    = new List <string>();

            Debug.WriteLine("     Print Part 3");
            foreach (def_PartSections ps in prt.def_PartSections)
            {
                // Debug.WriteLine("     ps.sectionId: " + ps.sectionId.ToString());
                def_Sections sct = formsRepo.GetSectionById(ps.sectionId);
                subscaleLabels.Add(sct.title);
                Debug.WriteLine("     sct.sectionId: " + sct.sectionId.ToString());


                //pull subscale scores from database
                string sctNumberLetter = sct.title.Substring(0, sct.title.IndexOf('.'));
                double totalRawScore   = getScoreResponse("scr_" + sctNumberLetter + "_raw");
                double standardScore   = getScoreResponse("scr_" + sctNumberLetter + "_std");
                double rawScoreAvg     = getScoreResponse("scr_" + sctNumberLetter + "_avg");
                double percentile      = getScoreResponse("scr_" + sctNumberLetter + "_pct");
                double confidenceLow   = Math.Max(0, standardScore - 1);
                double confidenceHigh  = standardScore + 1;

                percentiles[row] = percentile;
                string rowLabel = sct.title.Replace("ActivitiesHI", "");
                rowLabel = rowLabel.Replace("and Neighborhood", "...");
                supNeedsTableVals[row] = new string[] {
                    rowLabel,
                    (form.formId == 1) ? totalRawScore.ToString() : String.Format("{0:0.##}", rawScoreAvg),
                    standardScore.ToString(),
                    percentile.ToString(),
                    confidenceLow + "-" + confidenceHigh
                };

                row++;
            }

            //pull overall scores from database
            double totalRawScoreTotal       = getScoreResponse("scr_total_rawscores_all_SIS_sections");
            double standardScoreTotal       = getScoreResponse("scr_standard_score_total");
            double compositeIndex           = getScoreResponse("scr_support_needs_index");
            double compositePercentile      = getScoreResponse("scr_sni_percentile_rank");
            double totalRating              = getScoreResponse("scr_total_rating");
            double meanRating               = Math.Round((double)totalRating / 7, 2); //usd only for SIS-C reports

            AppendPartHeader(output, "Support Needs Profile - Graph");

            output.appendWrappedText("The graph provides a visual presentation of the six life activity areas from section 2. ", .5, 7.5);

            output.drawY -= .1;
            output.appendWrappedText("The graph reflects the pattern and intensity of the individual’s level of support. "
                                     + "The intent of the graph is to provide an easy means to prioritize the life activity areas in consideration "
                                     + "of setting goals and developing the Individual Support Plan. ", .5, 7.5);

            output.drawY -= .15;

            if (options[OptionKey.includeScores])
            {
                output.appendSimpleTable(
                    new string[] { "Activities Subscale", (form.formId == 1) ? "Total Raw Score" : "Average Raw Score",
                                   "Standard Score", "Percentile", "Confidence Interval (95%)" },
                    supNeedsTableVals,
                    new double[] { 0, .35, .35, .3, .35 });
                output.drawY -= PdfOutput.itemSpacing;

                if (form.identifier.Equals("SIS-A"))
                {
                    //for SIS-A, add a row to the bottom of the table, with totals
                    output.DrawLine(.75, output.drawY + .05, 7.75, output.drawY + .05, .01);
                    output.appendSimpleTable(
                        new string[] { "Total:",
                                       totalRawScoreTotal.ToString(),
                                       standardScoreTotal.ToString(), "", "" },
                        new string[0][],
                        new double[] { 0, .35, .35, .3, .35 },
                        new double[] { .08, .35, .35, .3, .35 }
                        );

                    output.drawY -= .2;
                }
                else
                {
                    //for SIS-C
                    output.appendItem("Overall Mean Rating", String.Format("{0:0.##}", meanRating), 2);
                }

                output.appendItem("SIS Support Needs Index", compositeIndex.ToString(), 2);
                output.appendItem("Percentile", compositePercentile.ToString(), 2);
                output.drawY -= PdfOutput.itemSpacing;
            }

            //AppendPartHeader(output, "Support Needs Profile");
            AppendReportChart(output, subscaleLabels.ToArray(), percentiles, compositePercentile);

            if (!options[OptionKey.includeScores])
            {
                return;
            }

            if (form.identifier.Equals("SIS-A"))
            {
                Debug.WriteLine("     Print Part 4");
                prt = formsRepo.GetPartByFormAndIdentifier(form, "Section 3. Supplemental Protection and Advocacy Scale");
                formsRepo.GetPartSections(prt);
                List <def_Sections> scts   = formsRepo.GetSectionsInPart(prt);
                def_Sections        proSct = scts[0];
                if (proSct == null)
                {
                    throw new Exception("could not find any sections in part \"Section 3. Supplemental Protection and Advocacy Scale\"");
                }

                List <def_Items> proItms = formsRepo.GetSectionItems(proSct);  // getItemsInSection(proSct);
                // RRB 3/17/15 - this is hokey, but not sure how else to do it at this point w/o the SectionItems.
                //                  should be checking SectionItems.subSectionId != null
                // Prune out the subSections (this is
                for (int i = 0; i < proItms.Count; i++)
                {
                    if (proItms[i].itemId == 1)
                    {
                        proItms.Remove(proItms[i]);
                    }
                }

                int        nProItms        = proItms.Count();
                string[][] supProTableVals = new string[nProItms][];
                for (int i = 0; i < nProItms; i++)
                {
                    def_Items itm      = proItms[i];
                    int       rawScore = 0;
                    // def_ItemResults itmResults = itm.def_ItemResults.SingleOrDefault(ir => ir.formResultId == formResultId);
                    def_ItemResults itmResults = formsRepo.GetItemResultByFormResItem(formResultId, itm.itemId);
                    for (int j = 0; j < 3; j++)
                    {
                        string suffix   = SupportNeedsColumnSuffixes[j];
                        string rspValue = null;

                        try
                        {
                            rspValue = itmResults.def_ResponseVariables.SingleOrDefault(rv => rv.def_ItemVariables.identifier.EndsWith(suffix)).rspValue;
                        }
                        catch (System.NullReferenceException ex)
                        {
                            Debug.Print("for itemId " + itm.itemId + ", could not find responseVariable linked to itemVariableIdentifier with suffix \"" + suffix + "\"");
                        }

                        try
                        {
                            rawScore += Int16.Parse(rspValue);
                        }
                        catch (Exception ex)
                        {
                            Debug.Print("could not parse integer from response value \"" + rspValue + "\"");
                        }
                    }

                    supProTableVals[i]    = new string[2];
                    supProTableVals[i][0] = itm.label;
                    supProTableVals[i][1] = rawScore.ToString();
                }

                output.drawY -= PdfOutput.itemSpacing;
                AppendPartHeader(output, "Section 3: Supplemental Protection and Advocacy Scale");
                output.appendSimpleTable(new string[] { "Protection and Advocacy Activities", "Raw Score" }, supProTableVals, new double[] { 0, .2 });

                output.drawY -= .2;
                output.appendWrappedText("The support needs profile reflects the pattern and intensity of the "
                                         + "individual’s support. The information provided in sections 1, 2, and 3, can be beneficial "
                                         + "in the development of the individual’s support plan.", .5, 7.5);
            }
        }
Ejemplo n.º 3
0
        public void printTable(PdfOutput output)
        {
            if (rows.Count == 0)
            {
                throw new Exception("Cannot print a table with no rows");
            }

            //draw top table border
            output.SetColor(Color.Black);
            output.DrawLine(bordersX[0], output.drawY,
                            bordersX[columnCount], output.drawY, cellBorderWidth);

            foreach (Row r in rows)
            {
                //compute row thickness before drawing, add page break if necessary
                double rowThickness = getRowThickness(output, r);
                if (output.drawY - rowThickness < 0)
                {
                    output.appendPageBreak();
                }

                if (r is RegularRow)
                {
                    string[] rowVals = ((RegularRow)r).contents;

                    //draw row background, if applicable
                    double y = output.drawY;
                    if (!r.background.Equals(Color.White))
                    {
                        output.SetColor(r.background);
                        output.FillRectangle(bordersX[0], output.drawY - rowThickness,
                                             bordersX[columnCount] - bordersX[0], rowThickness);
                        output.drawY = y;
                        output.SetColor(Color.Black);
                    }

                    //draw cell contents
                    for (int col = 0; col < columnCount; col++)
                    {
                        output.DrawWrappedText(
                            r.font, r.fontSize,
                            bordersX[col] + cellPaddingLeft,
                            output.drawY - cellContentsDy,
                            bordersX[col + 1] - bordersX[col] - cellPaddingRight,
                            TextJustify.Left,
                            rowVals[col] == null ? "N/A" : rowVals[col]);
                        output.drawY = y;
                    }

                    //draw cell borders
                    for (int col = 0; col <= columnCount; col++)
                    {
                        output.DrawLine(bordersX[col], output.drawY,
                                        bordersX[col], output.drawY - rowThickness, cellBorderWidth);
                    }
                    output.DrawLine(bordersX[0], output.drawY - rowThickness,
                                    bordersX[columnCount], output.drawY - rowThickness, cellBorderWidth);

                    //move down the page for the next row
                    output.drawY -= rowThickness;
                }
                else if (r is MergedRow)
                {
                    string content = ((MergedRow)r).contents;

                    //draw row background, if applicable
                    double y = output.drawY;
                    if (!r.background.Equals(Color.White))
                    {
                        output.SetColor(r.background);
                        output.FillRectangle(bordersX[0], output.drawY - rowThickness,
                                             bordersX[columnCount] - bordersX[0], rowThickness);
                        output.drawY = y;
                        output.SetColor(Color.Black);
                    }

                    //draw cell content
                    output.DrawWrappedText(
                        r.font, r.fontSize,
                        bordersX[0] + cellPaddingLeft,
                        output.drawY - cellContentsDy,
                        bordersX[columnCount] - bordersX[0] - cellPaddingRight,
                        TextJustify.Left,
                        content);
                    output.drawY = y;

                    //draw cell borders
                    output.DrawLine(bordersX[0], output.drawY,
                                    bordersX[0], output.drawY - rowThickness, cellBorderWidth);
                    output.DrawLine(bordersX[columnCount], output.drawY,
                                    bordersX[columnCount], output.drawY - rowThickness, cellBorderWidth);
                    output.DrawLine(bordersX[0], output.drawY - rowThickness,
                                    bordersX[columnCount], output.drawY - rowThickness, cellBorderWidth);

                    //move down the page for the next row
                    output.drawY -= rowThickness;
                }
                else
                {
                    throw new Exception("Unrecognized row subclass \"" + r.GetType() + "\"");
                }
            }
        }