public PMHRow(ClincalObservation co, HraView ParentView) { this.co = co; InitializeComponent(); owningView = ParentView; disease.Text = co.disease; ageDiagnosis.Text = co.ageDiagnosis; comments.Text = co.comments; }
private void button1_Click(object sender, EventArgs e) { if (pmh != null && sendingView != null) { ClincalObservation co = new ClincalObservation(pmh); co.disease = diseaseComboBox.Text; co.ageDiagnosis = AgeTextBox.Text; co.SetDiseaseDetails(); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; pmh.Observations.AddToList(co, args); this.Close(); } }
private static void ProcessPersonNode(XPathNavigator personNode, XPathNavigator riskMean_rootNode, ref Person targetPerson, bool isProband, ref int nextRelIdIfNeeded) { string dataroot; if (isProband) dataroot = "patientPerson"; else dataroot = "relationshipHolder"; XPathNavigator dataRootNode = personNode.SelectSingleNode(dataroot); ///////////////////////// //Age ///////////////////////// string age_val = personNode.Evaluate("string(subjectOf1/livingEstimatedAge/value/@value)").ToString(); if (string.IsNullOrEmpty(age_val) == false) { targetPerson.age = age_val; } else { age_val = personNode.Evaluate("string(subjectOf1/deceasedEstimatedAge/value/@value)").ToString(); if (string.IsNullOrEmpty(age_val) == false) { targetPerson.age = age_val; } } if (String.IsNullOrEmpty(age_val)) { //try to get age from the birthdate string birthDateRaw = personNode.Evaluate("string(patientPerson/birthTime/@value)").ToString(); if (!string.IsNullOrEmpty(birthDateRaw)) { //convert the raw birthdate in YYYYMMDD format to the current age string[] format = { "yyyyMMdd" }; //official HL7 date format DateTime birthDate; if (DateTime.TryParseExact(birthDateRaw, format, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out birthDate)) { DateTime today = DateTime.Today; int age = today.Year - birthDate.Year; if (birthDate > today.AddYears(-age)) age--; targetPerson.age = age.ToString(); } } } ////////////////////////// // other basics ////////////////////////// //old way fails when relative Id isn't integer in source xml/hl7 //targetPerson.relativeID = Convert.ToInt32(dataRootNode.Evaluate("string(id/@extension)").ToString()); int number; bool resultRelId = Int32.TryParse(dataRootNode.Evaluate("string(id/@extension)").ToString(), out number); if (resultRelId) { targetPerson.relativeID = number; } else { targetPerson.relativeID = nextRelIdIfNeeded++; } targetPerson.name = dataRootNode.Evaluate("string(name/@formatted)").ToString(); targetPerson.firstName = dataRootNode.Evaluate("string(name/@first)").ToString(); targetPerson.lastName = dataRootNode.Evaluate("string(name/@last)").ToString(); targetPerson.homephone = dataRootNode.Evaluate("string(telecom[@use='H']/@value)").ToString(); targetPerson.workphone = dataRootNode.Evaluate("string(telecom[@use='WP']/@value)").ToString(); targetPerson.gender = HL7FormatTranslator.GenderFromHL7(dataRootNode.Evaluate("string(administrativeGenderCode/@code)").ToString()); targetPerson.dob = HL7FormatTranslator.DateFromHL7(dataRootNode.Evaluate("string(birthTime/@value)").ToString()); ; targetPerson.vitalStatus = HL7FormatTranslator.VitalStatusFromHL7(dataRootNode.Evaluate("string(deceasedInd/@value)").ToString()); int temp_mom_id; int temp_dad_id; if (int.TryParse(dataRootNode.Evaluate("string(relative[code/@code='NMTH']/relationshipHolder/id/@extension)").ToString(), out temp_mom_id)) { targetPerson.motherID = temp_mom_id; } if (int.TryParse(dataRootNode.Evaluate("string(relative[code/@code='NFTH']/relationshipHolder/id/@extension)").ToString(), out temp_dad_id)) { targetPerson.fatherID = temp_dad_id; } ////////////////////////// // ethnicity ////////////////////////// XPathNodeIterator raceIter = dataRootNode.Select("raceCode"); foreach (XPathNavigator raceNode in raceIter) { string code = raceNode.Evaluate("string(@code)").ToString(); string displayName = raceNode.Evaluate("string(@displayName)").ToString(); string hraRaceText = HL7FormatTranslator.RaceFromHL7(code, displayName); if (hraRaceText == "Ashkenazi") { targetPerson.isAshkenazi = "Yes"; } else if (hraRaceText == "Hispanic") { targetPerson.isHispanic = "Yes"; } else { Race r = new Race(); r.race = hraRaceText; targetPerson.Ethnicity.Add(r); } } //SG encodes above in ethnicGroupCode rather than raceCode, so we check these too XPathNodeIterator ethnicIter = dataRootNode.Select("ethnicGroupCode"); foreach (XPathNavigator ethnicNode in ethnicIter) { string code = ethnicNode.Evaluate("string(@code)").ToString(); string displayName = ethnicNode.Evaluate("string(@displayName)").ToString(); string hraEthnicityText = HL7FormatTranslator.EthnicityFromHL7(code, displayName); if (hraEthnicityText == "Ashkenazi") { targetPerson.isAshkenazi = "Yes"; } else if (hraEthnicityText == "Hispanic or Latino") { targetPerson.isHispanic = "Yes"; } else if (hraEthnicityText == "not Hispanic or Latino") { targetPerson.isHispanic = "No"; } else { Race r = new Race(); r.race = hraEthnicityText; targetPerson.Ethnicity.Add(r); } } ////////////////////////// // Clinical Observations ////////////////////////// //PRB modified XPath in next to *not* include COs that are for cause of death, which SG duplicates from another CO with that same disease XPathNodeIterator coIter = personNode.Select(@"subjectOf2/clinicalObservation[not(sourceOf/@typeCode='CAUS')]"); foreach (XPathNavigator coNode in coIter) { string coText = coNode.Evaluate("string(code/@displayName)").ToString(); string coCode = coNode.Evaluate("string(code/@code)").ToString(); string coCodeSystem = coNode.Evaluate("string(code/@codeSystemName)").ToString(); string ageLowText = coNode.Evaluate("string(subject/dataEstimatedAge/value/low/@value)").ToString(); string ageHighText = coNode.Evaluate("string(subject/dataEstimatedAge/value/high/@value)").ToString(); string statusCode = coNode.Evaluate("string(statusCode/@code)").ToString(); string coValue = coNode.Evaluate("string(code/qualifier/value/@code)").ToString(); string coAgeDx = HL7FormatTranslator.GetIntFromHL7HighLow(ageLowText, ageHighText); string hra_tag = riskMean_rootNode.Evaluate("string(row[codeSystem/.='" + coCodeSystem + "'][code/.='" + coCode + "']/Mgh/.)").ToString(); if (string.IsNullOrEmpty(hra_tag) == false) { if (string.Compare(hra_tag, "Identical twin", true) == 0) { int temp; if (int.TryParse(coValue, out temp)) { targetPerson.twinID = temp; } } else { if (targetPerson is Patient) { Patient p = (Patient)targetPerson; bool result = processAsRiskFactorClinicalObservation(hra_tag, ref p, coAgeDx, statusCode, coValue); if (!result) { ClincalObservation co = new ClincalObservation(targetPerson.PMH); co.ClinicalObservation_disease = hra_tag; co.ClinicalObservation_ageDiagnosis = coAgeDx; targetPerson.PMH.Observations.Add(co); } } else { ClincalObservation co = new ClincalObservation(targetPerson.PMH); co.ClinicalObservation_disease = hra_tag; co.ClinicalObservation_ageDiagnosis = coAgeDx; targetPerson.PMH.Observations.Add(co); } } } else { ClincalObservation co = new ClincalObservation(targetPerson.PMH); co.ClinicalObservation_disease = coText; co.ClinicalObservation_ageDiagnosis = coAgeDx; targetPerson.PMH.Observations.Add(co); } } ////////////////////////// // Cause of Death ////////////////////////// XPathNavigator cdNav = personNode.SelectSingleNode(@"subjectOf2/clinicalObservation[sourceOf[@typeCode='CAUS']/clinicalObservation/code[(@displayName='death') or (@code='419620001')]]/code[1]"); if (cdNav != null) { string cdText = cdNav.Evaluate("string(@displayName)").ToString(); string cdCode = cdNav.Evaluate("string(@code)").ToString(); string cdCodeSystem = cdNav.Evaluate("string(@codeSystemName)").ToString(); string cd_hra_tag = riskMean_rootNode.Evaluate("string(row[codeSystem/.='" + cdCodeSystem + "'][code/.='" + cdCode + "']/Mgh/.)").ToString(); if (string.IsNullOrEmpty(cd_hra_tag) == false) { targetPerson.causeOfDeath = cd_hra_tag; } else { targetPerson.causeOfDeath = cdText; } } ////////////////////////// // Genetic Testing ////////////////////////// //Panels first XPathNodeIterator gtIter = personNode.Select("subjectOf2/geneticLocus"); List<GeneticTest> panels = new List<GeneticTest>(); List<string> panelNames = new List<string>(); foreach (XPathNavigator gtNode in gtIter) { string locusText = gtNode.Evaluate("string(text/.)").ToString(); if (string.IsNullOrEmpty(locusText) == false) { if (panelNames.Contains(locusText) == false) { GeneticTest new_panel = new GeneticTest(targetPerson.PMH); new_panel.comments = locusText; new_panel.GeneticTest_panelID = 34; panels.Add(new_panel); panelNames.Add(locusText); } } } //then results foreach(GeneticTest panel in panels) { XPathNodeIterator resultIter = personNode.Select("subjectOf2/geneticLocus[text/.='" + panel.comments + "']"); foreach (XPathNavigator resultNode in resultIter) { string geneName = resultNode.Evaluate("string(value/@displayName)").ToString(); if (string.IsNullOrEmpty(geneName) == false) { GeneticTestResult result = new GeneticTestResult(panel); result.geneName = geneName; string significance = resultNode.Evaluate("string(component3/sequenceVariation/interpretationCode/@code)").ToString(); result.resultSignificance = significance; panel.GeneticTestResults.Add(result); } } targetPerson.PMH.GeneticTests.Add(panel); } }
private void ageDiagnosis_Validated(object sender, EventArgs e) { foreach (ClincalObservation co in PMHHx.Observations) { if (co.disease.Equals("Bilateral Oophorectomy")) { if ((String.IsNullOrEmpty(ageDiagnosis.Text)) || (bothOvariesRemoved.Text != "Yes")) { PMHHx.Observations.RemoveFromList(co, SessionManager.Instance.securityContext); } else { co.ageDiagnosis = ageDiagnosis.Text; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; args.updatedMembers.Add(co.GetMemberByName("ageDiagnosis")); co.SignalModelChanged(args); } return; } } // add the disease... if (bothOvariesRemoved.Text.Equals("Yes")) { ClincalObservation co2 = new ClincalObservation(PMHHx); co2.disease = "Bilateral Oophorectomy"; co2.SetDiseaseDetails(); //SessionManager.Instance.MetaData.Diseases.SetDataFromDiseaseName(ref co2); co2.ageDiagnosis = ageDiagnosis.Text; HraModelChangedEventArgs args2 = new HraModelChangedEventArgs(null); args2.Persist = true; PMHHx.Observations.AddToList(co2, args2); } }
public void EditSurvey(RiskApps3.Model.PatientRecord.Patient proband, ViewModels.FamilyHistoryRelative obj) { RiskApps3.Model.PatientRecord.PastMedicalHistory pmh = new RiskApps3.Model.PatientRecord.PastMedicalHistory(proband); Person per = proband.FHx.Relatives.Where(p => p.relativeID == obj.RelativeId).FirstOrDefault(); per.vitalStatus = obj.VitalStatus; per.relationship = obj.Relationship; per.age = obj.RelativeAge; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.updatedMembers.Add(per.GetMemberByName("vitalStatus")); //args.updatedMembers.Add(per.GetMemberByName("relationship")); args.updatedMembers.Add(per.GetMemberByName("age")); per.BackgroundPersistWork(args); relative = per; relative.PMH.BackgroundLoadWork(); pmh = relative.PMH; SessionManager.Instance.MetaData.Diseases.BackgroundListLoad(); relative.PMH.BackgroundLoadWork(); for (int i = 0; i < 3; i++) { ClincalObservation co = new ClincalObservation(); if (i < pmh.Observations.Count) { co = (ClincalObservation)pmh.Observations[i]; } switch (i) { case 0: if (co.instanceID != 0) { co.disease = obj.FirstDx; co.ageDiagnosis = obj.FirstAgeOnset; co.SetDiseaseDetails(); HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null); args1.updatedMembers.Add(co.GetMemberByName("disease")); args1.updatedMembers.Add(co.GetMemberByName("ageDiagnosis")); co.BackgroundPersistWork(args1); } else { ClincalObservation co1 = new ClincalObservation(pmh); co1.disease = obj.FirstDx; co1.ageDiagnosis = obj.FirstAgeOnset; co1.SetDiseaseDetails(); HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null); args1.updatedMembers.Add(co1.GetMemberByName("disease")); args1.updatedMembers.Add(co1.GetMemberByName("ageDiagnosis")); co1.BackgroundPersistWork(args1); pmh.Observations.AddToList(co1, args1); } break; case 1: if (co.instanceID != 0) { co.disease = obj.SecondDx; co.ageDiagnosis = obj.SecondAgeOnset; co.SetDiseaseDetails(); HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null); args1.updatedMembers.Add(co.GetMemberByName("disease")); args1.updatedMembers.Add(co.GetMemberByName("ageDiagnosis")); co.BackgroundPersistWork(args1); } else { ClincalObservation co1 = new ClincalObservation(pmh); co1.disease = obj.SecondDx; co1.ageDiagnosis = obj.SecondAgeOnset; co1.SetDiseaseDetails(); HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null); args1.updatedMembers.Add(co1.GetMemberByName("disease")); args1.updatedMembers.Add(co1.GetMemberByName("ageDiagnosis")); co1.BackgroundPersistWork(args1); pmh.Observations.AddToList(co1, args1); } break; case 2: if (co.instanceID != 0) { co.disease = obj.ThirdDx; co.ageDiagnosis = obj.ThirdAgeOnset; co.SetDiseaseDetails(); HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null); args1.updatedMembers.Add(co.GetMemberByName("disease")); args1.updatedMembers.Add(co.GetMemberByName("ageDiagnosis")); co.BackgroundPersistWork(args1); } else { ClincalObservation co1 = new ClincalObservation(pmh); co1.disease = obj.ThirdDx; co1.ageDiagnosis = obj.ThirdAgeOnset; co1.SetDiseaseDetails(); HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null); args1.updatedMembers.Add(co1.GetMemberByName("disease")); args1.updatedMembers.Add(co1.GetMemberByName("ageDiagnosis")); co1.BackgroundPersistWork(args1); pmh.Observations.AddToList(co1, args1); } break; default: break; } } }
private void AddClinicalObservation(ClincalObservation co) { var add = ClinicalObservationDoesNotExist(co); if (add) { if (string.IsNullOrEmpty(co.disease) == false) { PedigreeLegendRow plr = new PedigreeLegendRow(); plr.SetObservation(co); flowLayoutPanel.Controls.Add(plr); this.Visible = true; } } }
private bool ClinicalObservationDoesNotExist(ClincalObservation co) { bool add = true; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow) c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (ClinicalObservationIsMatch(co, plrDisplayName, plrShortName)) { add = false; break; } } return add; }
internal void RemoveObservation(ClincalObservation co) { if (flowLayoutPanel.InvokeRequired) { RemoveObservationCallback aoc = new RemoveObservationCallback(RemoveObservation); object[] args = new object[1]; args[0] = co; this.Invoke(aoc, args); } else { Control toBeRemoved = null; int maxWidth = 0; int totalHeight = 0; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (ClinicalObservationIsMatch(co, plrDisplayName, plrShortName)) { toBeRemoved = c; } } if (toBeRemoved != null) { flowLayoutPanel.Controls.Remove(toBeRemoved); } CalculateOptimalDimensions(); CheckForEmpty(); } }
private static bool ClinicalObservationIsMatch(ClincalObservation co, string plrDisplayName, string plrShortName) { //TODO consider adding to ClinicalObservation.Equals return string.Compare(co.ClinicalObservation_diseaseDisplayName, plrDisplayName, true) == 0 && string.Compare(co.ClinicalObservation_diseaseShortName, plrShortName) == 0; }
/**************************************************************************************************/ private void AddDiseaseButton_Click(object sender, EventArgs e) { ClincalObservation co = new ClincalObservation(pmh); //SessionManager.Instance.MetaData.Diseases.SetDataFromDiseaseName(ref co); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = false; pmh.Observations.AddToList(co, args); noLabel.Visible = false; }
public void AddSingleObservation(ClincalObservation dx, bool isNew) { if (flowLayoutPanel.InvokeRequired) { AddSingleObservationCallback aoc = AddSingleObservation; object[] args = new object[1]; args[0] = dx; args[1] = isNew; this.Invoke(aoc, args); } else { AddClinicalObservation(dx); CalculateOptimalDimensions(); CheckForEmpty(); } }
internal void RemoveObservation(ClincalObservation co) { if (flowLayoutPanel.InvokeRequired) { RemoveObservationCallback aoc = new RemoveObservationCallback(RemoveObservation); object[] args = new object[1]; args[0] = co; this.Invoke(aoc, args); } else { Control toBeRemoved = null; bool noDups = true; int maxWidth = 0; int totalHeight = 0; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (string.Compare(co.ClinicalObservation_diseaseDisplayName, plrDisplayName, true) == 0 && string.Compare(co.ClinicalObservation_diseaseShortName, plrShortName) == 0) { if (noDups) { toBeRemoved = c; } else { noDups = false; } } else { if (plr.Width > maxWidth) maxWidth = plr.Width; totalHeight += plr.Height + legendPadding; } } if (toBeRemoved != null && noDups) { flowLayoutPanel.Controls.Remove(toBeRemoved); this.Height -= toBeRemoved.Height + legendPadding; if (maxWidth > 0 && this.Width > maxWidth + legendPadding) { this.Width = maxWidth + legendPadding; this.Height = totalHeight + legendPadding; } } this.Refresh(); CheckForEmpty(); } }
public void AddSingleObservation(ClincalObservation dx, bool isNew) { if (flowLayoutPanel.InvokeRequired) { AddSingleObservationCallback aoc = new AddSingleObservationCallback(AddSingleObservation); object[] args = new object[1]; args[0] = dx; args[1] = isNew; this.Invoke(aoc, args); } else { bool add = true; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (string.Compare(dx.ClinicalObservation_diseaseDisplayName, plrDisplayName, true) == 0 && string.Compare(dx.ClinicalObservation_diseaseShortName, plrShortName) == 0) { add = false; } } if (add) { if (string.IsNullOrEmpty(dx.disease) == false) { PedigreeLegendRow plr = new PedigreeLegendRow(); plr.SetObservation(dx); flowLayoutPanel.Controls.Add(plr); this.Height = flowLayoutPanel.Location.Y + plr.Location.Y + plr.Height + legendPadding; if (isNew) { if (flowLayoutPanel.Controls.Count == 1) { this.Location = new Point(SessionManager.Instance.MetaData.CurrentUserDefaultPedigreePrefs.GUIPreference_LegendX, SessionManager.Instance.MetaData.CurrentUserDefaultPedigreePrefs.GUIPreference_LegendY); } int maxWidth = 0; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow row = (PedigreeLegendRow)c; if (row.Width > maxWidth) maxWidth = row.Width; } if (maxWidth + legendPadding > this.Width) this.Width = maxWidth + legendPadding; } this.Refresh(); } } CheckForEmpty(); } }
private void OpenDiseaseDetails(ClincalObservation co) { if (co != null && co.Details != null) { if (co.Details.GetType().ToString() == "RiskApps3.Model.PatientRecord.PMH.BreastCancerDetails") { RiskApps3.View.PatientRecord.PMH.BreastCancerDetailsView bcdv = new RiskApps3.View.PatientRecord.PMH.BreastCancerDetailsView((RiskApps3.Model.PatientRecord.PMH.BreastCancerDetails)(co.Details)); bcdv.ShowDialog(); } if (co.Details.GetType().ToString() == "RiskApps3.Model.PatientRecord.PMH.ColonCancerDetails") { RiskApps3.View.PatientRecord.PMH.ColonCancerDetailsView bcdv = new RiskApps3.View.PatientRecord.PMH.ColonCancerDetailsView((RiskApps3.Model.PatientRecord.PMH.ColonCancerDetails)(co.Details)); bcdv.ShowDialog(); } } }
private void comboBox8_Validated(object sender, EventArgs e) { if (comboBox8.Tag != null) { ClincalObservation co = (ClincalObservation)comboBox8.Tag; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); if (comboBox8.Text.Length > 0) { co.disease = comboBox8.Text; co.ageDiagnosis = textBox4.Text; co.SetDiseaseDetails(); } else { args.Delete = true; } co.SignalModelChanged(args); } else if (comboBox8.Text.Length > 0) { ClincalObservation co = new ClincalObservation(pmh); co.disease = comboBox8.Text; co.ageDiagnosis = textBox4.Text; co.SetDiseaseDetails(); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); pmh.Observations.AddToList(co, args); comboBox8.Tag = co; } }
public void SetObservation(ClincalObservation newCo) { disease = (newCo.ClinicalObservation_diseaseShortName + " - " + newCo.ClinicalObservation_diseaseDisplayName).Trim(new char[] { ' ', '-' }); diseaseDisplayName = newCo.ClinicalObservation_diseaseDisplayName; diseaseIconArea = newCo.ClinicalObservation_diseaseIconArea; diseaseIconColor = newCo.ClinicalObservation_diseaseIconColor; diseaseIconType = newCo.ClinicalObservation_diseaseIconType; diseaseShortName = newCo.ClinicalObservation_diseaseShortName; if (string.IsNullOrEmpty(diseaseIconColor) == false) //(b != null) b = new SolidBrush(Color.FromName(diseaseIconColor)); SetRadiusAndTextOrigin(); MeasureText(); }