コード例 #1
0
ファイル: XMLFormat3.cs プロジェクト: spuller7/IR-Core-Review
    public override void OnDrawColumns()
    {
        this.Scroll = GUILayout.BeginScrollView(this.Scroll);
        {
            for (int i = 0; i < this.FormatList.Count; i++)
            {
                GUILayout.Space(5);

                Format3 format = this.FormatList[i];
                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUI.skin.textField.wordWrap = true;

                        // question
                        format.Question = EditorGUILayout.TextField(format.Question, GUILayout.Width(this.QuestionWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // image
                        format.Image = EditorGUILayout.TextField(format.Image, GUILayout.Width(this.ImageWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // is true
                        format.IsTrue = EditorGUILayout.Toggle(format.IsTrue, GUILayout.Width(this.IsTrueWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // fact
                        format.Fact = EditorGUILayout.TextField(format.Fact, GUILayout.Width(this.FactWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // correct answer
                        format.CorrectAnswer = EditorGUILayout.TextField(format.CorrectAnswer, GUILayout.Width(this.CorrectAnswerWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // wrong answer
                        format.WrongAnswerA = EditorGUILayout.TextField(format.WrongAnswerA, GUILayout.Width(this.WrongAnswerAWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // wrong answer
                        format.WrongAnswerB = EditorGUILayout.TextField(format.WrongAnswerB, GUILayout.Width(this.WrongAnswerBWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // wrong answer
                        format.WrongAnswerC = EditorGUILayout.TextField(format.WrongAnswerC, GUILayout.Width(this.WrongAnswerCWidth), GUILayout.Height(FieldHeight));
                        GUILayout.Space(5);
                        // delete entry
                        if (GUILayout.Button("X", EditorStyles.toolbarButton, GUILayout.Width(20), GUILayout.Height(FieldHeight)))
                        {
                            this.FormatList.RemoveAt(i);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
        }
        GUILayout.EndScrollView();
    }
コード例 #2
0
ファイル: ShpFile.cs プロジェクト: swr71999/ccmaps-net
            public byte[] GetImageData()
            {
                // make sure RawImageData is present/decoded if needed
                if (_decompressedImage == null)
                {
                    _f.Seek(ImgDataOffset, SeekOrigin.Begin);
                    int c_px = Width * Height;

                    // img.Header.compression &= 0x03;
                    if (CompressionType <= 1)
                    {
                        // Raw 8 bits-per-pixel image data
                        _decompressedImage = _f.Read(c_px);
                    }
                    else if (CompressionType == 2)
                    {
                        // Image data divided into scanlines {
                        // -- Length of scanline (ImageHeader.width + 2) : uint16
                        // -- Raw 8 bits-per-pixel image data : uint8[ImageHeader.width]
                        _decompressedImage = new byte[c_px];
                        int lineOffset = 0;
                        for (int y = 0; y < Height; y++)
                        {
                            ushort scanlineLength = (ushort)(_f.ReadUInt16() - sizeof(ushort));
                            _f.Read(_decompressedImage, lineOffset, scanlineLength);
                            lineOffset += scanlineLength;
                        }
                    }
                    else if (CompressionType == 3)
                    {
                        _decompressedImage = new byte[c_px];
                        var compressedEnd = (int)_f.Length;
                        if (_frameIndex < _f.Images.Count - 1)
                        {
                            compressedEnd = _f.Images[_frameIndex + 1].ImgDataOffset;
                        }
                        if (compressedEnd < ImgDataOffset)
                        {
                            compressedEnd = (int)_f.Length;
                        }
                        Format3.DecodeInto(_f.Read(compressedEnd - ImgDataOffset), _decompressedImage, Width, Height);
                    }
                    else
                    {
                        Logger.Debug("SHP image {0} frame {1} has unknown compression!", _f.FileName, _frameIndex);
                    }
                }

                return(_decompressedImage);
            }
コード例 #3
0
ファイル: DBHelper.cs プロジェクト: talhaabacus/IMRCrawler
        public int AddUpdateFormat3Detail(int tID, Format3 det)
        {
            IMRDataContext context    = new IMRDataContext();
            PDFDetail      pdfDetails = null;
            bool           addNew     = false;

            if (context.PDFDetails.Where(fdet => fdet.TreatmentID == tID).Any())
            {
                pdfDetails = context.PDFDetails.Single(fdet => fdet.TreatmentID == tID);
            }

            if (pdfDetails == null)
            {
                addNew     = true;
                pdfDetails = new PDFDetail();
            }

            pdfDetails.ClinicalCaseSummary = det.CaseSummary;
            pdfDetails.Age = det.Age;
            pdfDetails.DocumentsReviewed      = det.DocumentsReviewed;
            pdfDetails.Diagnosis              = det.Diagnosis;
            pdfDetails.Gender                 = det.Gender;
            pdfDetails.IssueAtDispute         = det.IssueAtDispute;
            pdfDetails.IMRIssuesRationales    = det.Rationales;
            pdfDetails.ReviewerQualifications = det.ReviewerQualifications;
            pdfDetails.TreatmentGuidelines    = det.TreatmentGuidelines;
            pdfDetails.TreatmentID            = tID;
            if (addNew)
            {
                context.PDFDetails.InsertOnSubmit(pdfDetails);
            }
            context.SubmitChanges();
            context.Connection.Close();
            context.Dispose();
            context = null;
            return(0);
        }
コード例 #4
0
ファイル: PDFParser.cs プロジェクト: talhaabacus/IMRCrawler
        private void ParseFormat3Text()
        {
            try
            {
                Format3 f = new Format3();


                int issueindex         = _text.IndexOf("ISSUE AT DISPUTE:");
                int caseindex          = _text.IndexOf("CASE SUMMARY:");
                int reviewedindex      = _text.IndexOf("DOCUMENTS REVIEWED FOR DETERMINATION:");
                int guidelineindex     = _text.IndexOf("MEDICAL TREATMENT GUIDELINE(S) RELIED UPON BY PROFESSIONAL \r\nREVIEWER AND WHY:");
                int rationaleindex     = _text.IndexOf("RATIONALE FOR WHY THE REQUESTED TREATMENT/SERVICE IS/WAS NOT \r\nMEDICALLY NECESSARY:");
                int qualificationindex = _text.IndexOf("MEDICAL REVIEWER QUALIFICATIONS:");

                f.IssueAtDispute         = _text.Substring(issueindex + 17, caseindex - issueindex - 17).Trim();
                f.CaseSummary            = _text.Substring(caseindex + 13, reviewedindex - caseindex - 13).Trim();
                f.DocumentsReviewed      = _text.Substring(reviewedindex + 37, guidelineindex - reviewedindex - 37).Trim();
                f.TreatmentGuidelines    = _text.Substring(guidelineindex + 80, rationaleindex - guidelineindex - 80).Trim();
                f.Rationales             = _text.Substring(rationaleindex + 85, qualificationindex - rationaleindex - 85).Trim();
                f.ReviewerQualifications = _text.Substring(qualificationindex + 32).Trim();

                string diagnosisPart = "";
                if (_text.IndexOf(" year old") != -1)
                {
                    string text = _text.Substring(0, _text.IndexOf(" year old"));
                    string a    = text.Substring(text.LastIndexOf(' ')).Trim();
                    try
                    {
                        f.Age = Int32.Parse(a);
                    }
                    catch (Exception)
                    {
                        f.Age = 0;
                    }

                    text          = _text.Substring(_text.IndexOf(" year old ") + 9).Trim();
                    diagnosisPart = text;
                    a             = text.Substring(0, text.IndexOf(' ')).Trim();
                    f.Gender      = a.Replace(',', ' ').Trim();
                    if ((f.Gender.ToLower() != "male") && (f.Gender.ToLower() != "female"))
                    {
                        if (_text.IndexOf(" female ") > 0)
                        {
                            f.Gender = "female";
                        }
                        else if (_text.IndexOf(" male ") > 0)
                        {
                            f.Gender = "male";
                        }
                    }
                }
                else if (_text.IndexOf("-year-old") != -1)
                {
                    string text = _text.Substring(0, _text.IndexOf("-year-old"));
                    string a    = text.Substring(text.LastIndexOf(' ')).Trim();
                    try
                    {
                        f.Age = Int32.Parse(a);
                    }
                    catch (Exception)
                    {
                        f.Age = 0;
                    }
                    text          = _text.Substring(_text.IndexOf("-year-old") + 9).Trim();
                    diagnosisPart = text;
                    a             = text.Substring(0, text.IndexOf(' ')).Trim();

                    f.Gender = a.Replace(',', ' ').Trim();
                    if ((f.Gender.ToLower() != "male") && (f.Gender.ToLower() != "female"))
                    {
                        if (_text.IndexOf(" female ") > 0)
                        {
                            f.Gender = "female";
                        }
                        else if (_text.IndexOf(" male ") > 0)
                        {
                            f.Gender = "male";
                        }
                    }
                }

                diagnosisPart = diagnosisPart.Substring(diagnosisPart.IndexOf(".") + 1).Trim();

                if (diagnosisPart.ToLower().IndexOf("diagnosis") != -1)
                {
                    diagnosisPart = diagnosisPart.Substring(diagnosisPart.ToLower().IndexOf("diagnosis"));
                    f.Diagnosis   = diagnosisPart.Substring(0, diagnosisPart.IndexOf(".")).Trim();
                }
                else if (diagnosisPart.ToLower().IndexOf("diagnosed") != -1)
                {
                    diagnosisPart = diagnosisPart.Substring(diagnosisPart.ToLower().IndexOf("diagnosed"));
                    f.Diagnosis   = diagnosisPart.Substring(0, diagnosisPart.IndexOf("."));
                }
                else if (diagnosisPart.ToLower().IndexOf("diagnoses") != -1)
                {
                    diagnosisPart = diagnosisPart.Substring(diagnosisPart.ToLower().IndexOf("diagnoses"));
                    f.Diagnosis   = diagnosisPart.Substring(0, diagnosisPart.IndexOf("."));
                }
                else if (diagnosisPart.ToLower().IndexOf("diagnosistic") != -1)
                {
                    diagnosisPart = diagnosisPart.Substring(diagnosisPart.ToLower().IndexOf("diagnosistic"));
                    f.Diagnosis   = diagnosisPart.Substring(0, diagnosisPart.IndexOf("."));
                }
                else
                {
                    f.Diagnosis = diagnosisPart.Substring(0, diagnosisPart.IndexOf(".")).Trim();
                }

                DBHelper helper = new DBHelper();
                helper.AddUpdateFormat3Detail(_treatmentID, f);
            }
            catch (Exception e)
            {
                throw new Exception("Could not parse PDF ", e);
            }
        }
コード例 #5
0
ファイル: XMLFormat3.cs プロジェクト: spuller7/IR-Core-Review
    public void XMLLoad(string path)
    {
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.LoadXml(path == string.Empty ? EditorPrefs.GetString("lastXML_format3") : File.ReadAllText(path));
        int index  = 0;
        int answer = 0;

        foreach (XmlNode xmlNode in xmlDoc.DocumentElement)
        {
            Format3 format = new Format3();
            // get all parent nodes
            foreach (XmlNode questionsNode in xmlNode)
            {
                if (questionsNode.Name == "Question")
                {
                    format.Question = questionsNode.InnerText;
                }
                if (questionsNode.Name == "Image")
                {
                    format.Image = questionsNode.InnerText;
                }
                if (questionsNode.Name == "IsTrue")
                {
                    format.IsTrue = questionsNode.InnerText == "0" ? false : true;
                }
                if (questionsNode.Name == "Fact")
                {
                    format.Fact = questionsNode.InnerText;
                }
                if (questionsNode.Name == "Answers")
                {
                    foreach (XmlNode answersNode in questionsNode)
                    {
                        if (answersNode.Name == "Choices")
                        {
                            if (answer == 0)
                            {
                                format.CorrectAnswer = answersNode.InnerText;
                            }
                            else if (answer == 1)
                            {
                                format.WrongAnswerA = answersNode.InnerText;
                            }
                            else if (answer == 2)
                            {
                                format.WrongAnswerB = answersNode.InnerText;
                            }
                            else if (answer == 3)
                            {
                                format.WrongAnswerC = answersNode.InnerText;
                            }
                            answer++;
                        }
                    }
                }
                answer = 0;
                index++;
            }
            this.FormatList.Add(format);
        }
    }
コード例 #6
0
ファイル: XMLFormat3.cs プロジェクト: spuller7/IR-Core-Review
    public string XMLSave(string path)
    {
        XmlWriter xmlWriter = XmlWriter.Create(path);

        xmlWriter.WriteStartDocument();

        xmlWriter.WriteStartElement("QuestionDatabase");

        // write question data
        for (int i = 0; i < this.FormatList.Count; i++)
        {
            Format3 format = this.FormatList[i];
            xmlWriter.WriteStartElement("Questions");

            xmlWriter.WriteStartElement("Question");
            xmlWriter.WriteString(format.Question);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Image");
            xmlWriter.WriteString(format.Image);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("IsTrue");
            xmlWriter.WriteString(format.IsTrue ? "1" : "0");
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Fact");
            xmlWriter.WriteString(format.Fact);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteStartElement("Answers");

            if (format.CorrectAnswer.Length > 0)
            {
                xmlWriter.WriteStartElement("Choices");
                xmlWriter.WriteAttributeString("correct", "true");
                xmlWriter.WriteString(format.CorrectAnswer);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("Choices");
                xmlWriter.WriteAttributeString("correct", "false");
                xmlWriter.WriteString(format.WrongAnswerA);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("Choices");
                xmlWriter.WriteAttributeString("correct", "false");
                xmlWriter.WriteString(format.WrongAnswerB);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("Choices");
                xmlWriter.WriteAttributeString("correct", "false");
                xmlWriter.WriteString(format.WrongAnswerC);
                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteEndElement();

            xmlWriter.WriteEndElement();
        }

        xmlWriter.WriteEndElement();

        xmlWriter.WriteEndDocument();
        xmlWriter.Close();

        string content = File.ReadAllText(path);

        content = UTF8ByteArrayToString(StringToUTF8ByteArray(content));
        return(content);
    }