public async Task <IHttpActionResult> Get(Guid id) { ResponseModel <FamilyHistoryViewModel> Response = null; FamilyHistoryViewModel ReturnObject = null; if (!id.Equals(null)) { FamilyHistory DBData = _iFamilyHistoryService.GetFamilyHistoryByID(id.ToString(), ref ErrorMessage); if (DBData != null) { ReturnObject = Mapper.Map <FamilyHistory, FamilyHistoryViewModel>(DBData); } } else { ReturnObject = new FamilyHistoryViewModel(); } Response = new ResponseModel <FamilyHistoryViewModel>() { Response = ReturnObject, Message = ErrorMessage, ResponseCode = HttpContext.Current.Response.StatusCode, ResponseDescription = HttpContext.Current.Response.StatusDescription, SubStatusCode = HttpContext.Current.Response.SubStatusCode }; return(await Task.FromResult(Content((HttpStatusCode)Response.ResponseCode, Response))); }
public async Task <IActionResult> Edit(int id, [Bind("FamilyMemberId,FamilyMemberType,FamilyMemberFirstName,FamilyMemberLastName,DiseaseDisorder,LivingOrDeceased,AgeAtOnset,AgeAtDeath,ConditionCauseOfDeath,Comments")] FamilyHistory familyHistory) { if (id != familyHistory.FamilyMemberId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(familyHistory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FamilyHistoryExists(familyHistory.FamilyMemberId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(familyHistory)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,FamilyMember,FirstName,LastName,Disease,CauseOfDeath,Comments")] FamilyHistory familyHistory) { if (id != familyHistory.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(familyHistory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FamilyHistoryExists(familyHistory.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(familyHistory)); }
public async Task <IActionResult> Create([Bind("FamilyMemberId,FamilyMemberType,FamilyMemberFirstName,FamilyMemberLastName,DiseaseDisorder,LivingOrDeceased,AgeAtOnset,AgeAtDeath,ConditionCauseOfDeath,Comments")] FamilyHistory familyHistory) { if (ModelState.IsValid) { _context.Add(familyHistory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(familyHistory)); }
public async Task <IActionResult> Create([Bind("ID,FamilyMember,FirstName,LastName,Disease,CauseOfDeath,Comments")] FamilyHistory familyHistory) { if (ModelState.IsValid) { _context.Add(familyHistory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(familyHistory)); }
public FamilyHistory GetFamilyHistoryByID(string ID, ref string errorMessage) { try { FamilyHistory data = familyHistoryInfoRepo.Get(x => (x.RecordID.ToString() == ID), ref errorMessage).FirstOrDefault(); return(data); } catch (Exception Ex) { errorMessage = Ex.Message; } return(null); }
public VM.HraXmlFile ExportAsXml(string mrn, int apptId, bool Identified) { string rootPath = HttpContext.Current.Server.MapPath(Constants.RAFilePath); _hraSessionManager.SetActivePatient(mrn, apptId); Patient _patient = SessionManager.Instance.GetActivePatient(); _patient.LoadFullObject(); FamilyHistory theFH = _patient.owningFHx; string fileName = SessionManager.Instance.GetActivePatient().name + " " + SessionManager.Instance.GetActivePatient().unitnum + " Serialization " + DateTime.Now.ToString("yyyy-MM-dd-HHmm"); if (!Directory.Exists(System.IO.Path.Combine(rootPath, "Download"))) { Directory.CreateDirectory(System.IO.Path.Combine(rootPath, "Download")); } string filePath = System.IO.Path.Combine(rootPath, "Download", fileName); if (!Identified) { //legacy code chunk; written before caring about de-identifying DataContractSerializer ds = new DataContractSerializer(typeof(FamilyHistory)); FileStream stm = new FileStream(filePath, FileMode.Create); ds.WriteObject(stm, theFH); stm.Flush(); stm.Position = 0; stm.Close(); } else { string fhAsString = TransformUtils.DataContractSerializeObject <FamilyHistory>(theFH); //transform it XmlDocument inDOM = new XmlDocument(); inDOM.LoadXml(fhAsString); XmlDocument resultXmlDoc = TransformUtils.performTransform(inDOM, rootPath, @"hraDeIdentifySerialized.xsl"); //following actually removes all indentation and extra whitespace; prefer to save the file with indentations, so leave this commented //hl7FHData.PreserveWhitespace = true; resultXmlDoc.Save(filePath); } VM.HraXmlFile xmlFile = new VM.HraXmlFile() { FileName = fileName, FilePath = filePath, Estension = ".xml" }; return(xmlFile); }
public HttpResponseMessage AddUpdateFamilyHistory(FamilyHistoryViewModel data) { try { ResponseCodeModel ResponseData = new ResponseCodeModel(); FamilyHistory DBData = _iFamilyHistoryService.SaveFamilyHistoryDetails(data, ref ErrorMessage); if (DBData != null) { ResponseData.Data = DBData; DBData.RecordID = Guid.NewGuid(); return(HttpOkRequest(ResponseData)); } ResponseData.Data = null; ResponseData.Message = "No Record Found"; return(HttpBadRequest(ResponseData)); } catch (Exception Ex) { return(HttpResponseError(Ex)); } }
public HRAStep3(HRA HRA, int HRAID) { InitializeComponent(); HRAid = HRAID; objHRA = HRA; lstCommonDropDown.Add(new CommonDropDowns(1, "Yes")); lstCommonDropDown.Add(new CommonDropDowns(0, "No")); lstCommonDropDown.Add(new CommonDropDowns(2, "Don't Know")); BindValues(); if (HRA != null) { if (HRA.data.family_history != null) { objFamilyHistory = HRA.data.family_history; ShowData(); } } }
public bool?SoftDeleteFamilyHistory(Guid id, ref string errorMessage) { try { FamilyHistory DBDataCollection = familyHistoryInfoRepo.Get(x => x.RecordID == id, ref errorMessage).FirstOrDefault(); if (DBDataCollection == null) { errorMessage = "No records found."; return(null); } DBDataCollection.DeletionDate = DateTime.UtcNow; DBDataCollection.IsDeleted = true; familyHistoryInfoRepo.SoftDelete(DBDataCollection, ref errorMessage); unitOfWork.Commit(); return(true); } catch (Exception Ex) { errorMessage = Ex.Message; } return(false); }
/// <summary> /// Export patient details as xml. /// </summary> /// <param name="mrn">MRN for a patient</param> /// <param name="apptId">Appointment Id of the selected appointment</param> /// <param name="Identified">True for DeIdentified and false for Identitify</param> /// <returns>Returns xml file for download.</returns> public VM.HraXmlFile ExportAsHL7(string mrn, int apptId, bool Identified) { string rootPath = HttpContext.Current.Server.MapPath(Constants.RAFilePath); _hraSessionManager.SetActivePatient(mrn, apptId); Patient _patient = SessionManager.Instance.GetActivePatient(); _patient.LoadFullObject(); FamilyHistory theFH = _patient.owningFHx; string fhAsString = TransformUtils.DataContractSerializeObject <FamilyHistory>(theFH); XmlDocument inDOM = new XmlDocument(); inDOM.LoadXml(fhAsString); XmlDocument resultXmlDoc = TransformUtils.performTransform(inDOM, rootPath, @"hra_to_ccd_remove_namespaces.xsl"); XmlDocument hl7FHData = TransformUtils.performTransformWithParam(resultXmlDoc, rootPath, @"hra_serialized_to_hl7.xsl", "deIdentify", Identified ? "1" : "0"); string filename = SessionManager.Instance.GetActivePatient().name + " " + SessionManager.Instance.GetActivePatient().unitnum + " HL7 " + DateTime.Now.ToString("yyyy-MM-dd-HHmm"); if (!Directory.Exists(System.IO.Path.Combine(rootPath, "Download"))) { Directory.CreateDirectory(System.IO.Path.Combine(rootPath, "Download")); } string filePath = System.IO.Path.Combine(rootPath, "Download", filename); hl7FHData.Save(filePath); VM.HraXmlFile xmlFile = new VM.HraXmlFile(); xmlFile.FileName = filename; xmlFile.FilePath = filePath; xmlFile.Estension = ".xml"; return(xmlFile); }
public FamilyHistory SaveFamilyHistoryDetails(FamilyHistoryViewModel data, ref string errorMessage) { try { FamilyHistory DBData = Mapper.Map <FamilyHistoryViewModel, FamilyHistory>(data); if (DBData.ID == 0 && DBData.RecordID.ToString() == "00000000-0000-0000-0000-000000000000") { DBData.CreatedOn = DateTime.UtcNow; DBData.RecordID = Guid.NewGuid(); familyHistoryInfoRepo.Add(DBData, ref errorMessage); } else { FamilyHistory savedData = familyHistoryInfoRepo.Get(x => x.RecordID == DBData.RecordID, ref errorMessage).FirstOrDefault(); DBData.ID = savedData.ID; DBData.Modifiedon = DateTime.UtcNow; familyHistoryInfoRepo.Update(savedData, DBData, ref errorMessage); } unitOfWork.Commit(); return(DBData); } catch (Exception Ex) { errorMessage = Ex.Message; } return(null); }
public ActionResult EditFamilyDetails(FamilyHistory familyDetails) { try { bool status = false; string message = string.Empty; if (ModelState.IsValid) { familyDetails.UserID = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1]); userName = System.Web.HttpContext.Current.User.Identity.Name.Split('|')[0]; Mapper.CreateMap <FamilyHistory, Data.EmployeeFamilyDetail>(); var EmpfamilyDetails = Mapper.Map <FamilyHistory, Data.EmployeeFamilyDetail>(familyDetails); #region Make only one emergency contact if (familyDetails.IsEmergencyContact == true) { var lstEmployeeFamilyDetails = _IFamilyDetailsService.GetEmployeeFamilyDetailsByUserID((int)familyDetails.UserID).Where(p => p.IsEmergencyContact == true); foreach (EmployeeFamilyDetail employeeFamilyDetail in lstEmployeeFamilyDetails) { employeeFamilyDetail.IsEmergencyContact = false; var isSuccess = _IFamilyDetailsService.Update(employeeFamilyDetail, null, ""); if (!isSuccess) { return(Json(new { success = false, response = "Unable to add family detail." })); } } } #endregion if (EmpfamilyDetails.UpdatedBy == null || EmpfamilyDetails.UpdatedBy == "") { EmpfamilyDetails.UpdatedBy = userName; } if (EmpfamilyDetails.UpdatedDate == DateTime.MinValue || EmpfamilyDetails.UpdatedDate == null) { EmpfamilyDetails.UpdatedDate = DateTime.UtcNow; } EmpfamilyDetails.IsActive = true; status = _IFamilyDetailsService.Update(EmpfamilyDetails, null, ""); if (status == true) { return(Json(status)); } return(Json(status)); } else { ViewBag.Relationship = GetRelationshipList(); ViewBag.DependentList = GetDependentList(); ViewBag.GenderList = GetGenderList(); var modelStateErrors = this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors); foreach (var modelStateError in modelStateErrors) { message += modelStateError.ErrorMessage + Environment.NewLine; } return(Json(new { success = false, response = message })); } } catch (Exception ex) { throw; } }
public PedigreeModel(FamilyHistory p_familyHistory) { familyHistory = p_familyHistory; //Store the individuals as PedigreeIndividuals lock (familyHistory.Relatives) { foreach (Person Person in familyHistory.Relatives) { PedigreeIndividual pedigreeIndividual = new PedigreeIndividual(Person); individuals.Add(pedigreeIndividual); individualsDictionary[Person.relativeID] = pedigreeIndividual; points.Add(pedigreeIndividual.point); } } //here keys are the couple ids, values are the couples to which they map couplesDictionary = new Dictionary <CoupleID, PedigreeCouple>(); //Link PedigreeIndividuals with their parents in the object model, derive couples foreach (PedigreeIndividual child in individuals) { //determine whether or not each parent exists in the data bool hasMother = individualsDictionary.ContainsKey(child.HraPerson.motherID); bool hasFather = individualsDictionary.ContainsKey(child.HraPerson.fatherID); CoupleID coupleId = new CoupleID(child.HraPerson.fatherID, child.HraPerson.motherID); if (hasMother || hasFather) { //link individuals with their parents in the object model, forming a pointer graph if (hasMother) { child.Mother = individualsDictionary[child.HraPerson.motherID]; } if (hasFather) { child.Father = individualsDictionary[child.HraPerson.fatherID]; } //derive couples and store them { //if this individual has parents, set it's "parents" pointer to the //couple representing it's parents (deriving couples from the data as needed). //get the parents couple PedigreeCouple parents = null; { //check if the parents have already been stored as a couple if (couplesDictionary.ContainsKey(coupleId)) { //if so, then use the previously stored couple. parents = couplesDictionary[coupleId]; } else { //if not store parents as a couple if they haven't been already parents = new PedigreeCouple(child.Mother, child.Father); couplesDictionary[coupleId] = parents; couples.Add(parents); points.Add(parents.point); //link participating individuals with the new couple if (child.Mother != null) { if (child.Mother.spouseCouples != null) { child.Mother.spouseCouples.Add(parents); } } if (child.Father != null) { if (child.Father.spouseCouples != null) { child.Father.spouseCouples.Add(parents); } } } } //set this individual's "parents" pointer to the parents couple child.Parents = parents; //add the child to the children of the parents couple parents.children.Add(child); } } } // derive the intergenerational edges of the couples graph foreach (PedigreeIndividual parent in individuals) { bool parentHasGrandparents = parent.Parents != null; bool parentIsPartOfACouple = parent.spouseCouples.Count != 0; if (parentHasGrandparents && parentIsPartOfACouple) { foreach (PedigreeCouple parents in parent.spouseCouples) { PedigreeCouple grandparents = parent.Parents; bool intergenerational = true; coupleEdges.Add(new PedigreeCoupleEdge(grandparents, parents, intergenerational)); } } } // derive the intragenerational edges of the couples graph // (from half sibling relationships) foreach (PedigreeIndividual parent in individuals) { if (parent.spouseCouples.Count == 2) { PedigreeCouple u = parent.spouseCouples[0]; PedigreeCouple v = parent.spouseCouples[1]; bool intergenerational = false; coupleEdges.Add(new PedigreeCoupleEdge(u, v, intergenerational)); } //else if (parent.spouseCouples.Count > 2) // throw new Exception("Pedigree not drawable: individual " + parent.relativeID + " has more than two spouses"); } //derive generational levels bool undefinedLevelsRemain = true; int minGenerationalLevel = 0; int maxGenerationalLevel = 0; if (couples.Count > 0) { //assign the seed level couples[0].GenerationalLevel = 0; //propagate the seed level through the graph int NULL = PedigreeCouple.UNDEFINED_GENERATION; while (undefinedLevelsRemain) { undefinedLevelsRemain = false; foreach (PedigreeCoupleEdge e in coupleEdges) { if (e.intergenerational) { PedigreeCouple grandparents = e.u; PedigreeCouple parents = e.v; bool parentsHaveLevel = parents.GenerationalLevel != NULL; bool grandparentsHaveLevel = grandparents.GenerationalLevel != NULL; if (!parentsHaveLevel || !grandparentsHaveLevel) { undefinedLevelsRemain = true; } if (!parentsHaveLevel && !grandparentsHaveLevel) { undefinedLevelsRemain = false; } if (parentsHaveLevel && !grandparentsHaveLevel) { grandparents.GenerationalLevel = parents.GenerationalLevel - 1; if (grandparents.GenerationalLevel < minGenerationalLevel) { minGenerationalLevel = grandparents.GenerationalLevel; } } else if (!parentsHaveLevel && grandparentsHaveLevel) { parents.GenerationalLevel = grandparents.GenerationalLevel + 1; if (parents.GenerationalLevel > maxGenerationalLevel) { maxGenerationalLevel = parents.GenerationalLevel; } } } else { //propagate levels through intragenerational edges (half siblings) if (e.u.GenerationalLevel == NULL) { e.u.GenerationalLevel = e.v.GenerationalLevel; } else if (e.v.GenerationalLevel == NULL) { e.v.GenerationalLevel = e.u.GenerationalLevel; } } } } } //normalize the levels foreach (PedigreeCouple couple in couples) { couple.GenerationalLevel -= minGenerationalLevel; } //store the (normalized) max level in the model this.maxGenerationalLevel = maxGenerationalLevel - minGenerationalLevel; //when a parent set of half siblings (father, mother, father) //is detedted, the mother id is added to this list. If a //couple involving this mother is detected later, this //list is checked to see if she has already been counted. List <int> halfSiblingParentsMotherIds = new List <int>(); //derive individual sets foreach (PedigreeCouple couple in couples) { //add the [mother,father] individual sets if (couple.mother != null && couple.father != null) { if (couple.mother.Parents == null && couple.father.Parents == null) { //if the mother has a single spouse if (couple.mother.spouseCouples.Count == 1) { PedigreeIndividualSet parentsIndividualSet = new PedigreeIndividualSet(couple); parentsIndividualSet.Add(couple.mother); parentsIndividualSet.Add(couple.father); AddIndividualSet(couple.GenerationalLevel, parentsIndividualSet); } //if the mother has a two spouses else if (couple.mother.spouseCouples.Count == 2) { //collapse parents of half siblings into a single individual set if (!halfSiblingParentsMotherIds.Contains(couple.mother.HraPerson.relativeID)) { halfSiblingParentsMotherIds.Add(couple.mother.HraPerson.relativeID); PedigreeIndividualSet parentsIndividualSet = new PedigreeIndividualSet(couple); parentsIndividualSet.Add(couple.mother); parentsIndividualSet.Add(couple.mother.spouseCouples[0].father); parentsIndividualSet.Add(couple.mother.spouseCouples[1].father); AddIndividualSet(couple.GenerationalLevel, parentsIndividualSet); } } } try { //add the children individual sets PedigreeIndividualSet childrenIndividualSet = new PedigreeIndividualSet(couple); foreach (PedigreeIndividual child in couple.children) { childrenIndividualSet.Add(child); foreach (PedigreeCouple pc in child.spouseCouples) { if (pc.mother.HraPerson.relativeID == child.HraPerson.relativeID) { childrenIndividualSet.Add(pc.father); } else { childrenIndividualSet.Add(pc.mother); } } } AddIndividualSet(couple.GenerationalLevel + 1, childrenIndividualSet); } catch (Exception e) { Logger.Instance.WriteToLog(e.ToString()); } } } if (individualsDictionary.ContainsKey(1)) { SetBloodRelatives(individualsDictionary[1]); } foreach (PedigreeIndividual pi in individuals) { if (pi.bloodRelative == false) { if (pi.spouseCouples.Count == 0) { pi.bloodRelative = true; } else { bool bloodFound = false; foreach (PedigreeCouple pc in pi.spouseCouples) { if ((pc.mother != null) && (pc.father != null)) { if (pc.mother.bloodRelative == true || pc.father.bloodRelative == true) { bloodFound = true; } } } if (bloodFound == false) { foreach (PedigreeCouple pc in pi.spouseCouples) { if (pc.mother != null) { pc.mother.bloodRelative = true; } if (pc.father != null) { pc.father.bloodRelative = true; } } } } } } this.FamilialVariants = p_familyHistory.ReloadFamilialVariants(); }
public Treatment GetTreatment(FamilyHistory occurances, LabResult lab) { // return Some Treatment object that can be different based on the // calculated risk from the arguments. }
public async Task <IEnumerable <PhysicalExamAntiAgingViewModel> > GetExamAntiAgingByEpiRowIdAsync(long epiRowId) { var physicalExam = await _questionnaireRepository.GetPhysicalExamAntiAgingAsync(epiRowId); var results = new List <PhysicalExamAntiAgingViewModel>(); foreach (var item in physicalExam) { var history = new History() { QCC = item.QCC, QCCText = item.QCCText, QCCOtherText = item.QCCOtherText, QUnderlying = item.QUnderlying, QCurrentMed = item.QCurrentMed, QSupplementation = item.QSupplementation, QHistoryInvestigation = item.QHistoryInvestigation, QGI = item.QGI, QGOText = item.QGOText, QSleep = item.QSleep, QSleepHours = item.QSleepHours, QSleepText = item.QSleepText, QSkin = item.QSkin, QSkinText = item.QSkinText, QMemory = item.QMemory, QMemoryText = item.QMemoryText, QImmune = item.QImmune, QImmuneText = item.QImmuneText, QSexual = item.QSexual, QSexualText = item.QSexualText, QExercise = item.QExercise, }; var isHistory = history.GetType().GetProperties() .Where(h => h.GetValue(history) is string) .Select(h => (string)h.GetValue(history)) .Any(value => !String.IsNullOrEmpty(value)); var genetic = new Genetic() { QGenetic = item.QGenetic }; var isGenetic = genetic.GetType().GetProperties() .Where(g => g.GetValue(genetic) is string) .Select(g => (string)g.GetValue(genetic)) .Any(value => !String.IsNullOrEmpty(value)); var familyHistory = new FamilyHistory() { QFamilyFather = item.QFamilyFather, QFamilyMother = item.QFamilyMother }; var isFamilyHistory = familyHistory.GetType().GetProperties() .Where(f => f.GetValue(familyHistory) is string) .Select(f => (string)f.GetValue(familyHistory)) .Any(value => !String.IsNullOrEmpty(value)); var physicalExamination = new PhysicalExamination() { QENTPE = item.QENTPE, QAbdomenPE = item.QAbdomenPE, QAbdomenPEText = item.QAbdomenPEText, QCardiovascularPE = item.QCardiovascularPE, QCardiovascularPEText = item.QCardiovascularPEText, QENTNeckNode = item.QENTNeckNode, QENTPEText = item.QENTPEText, QENTPharynx = item.QENTPharynx, QENTTonsils = item.QENTTonsils, QGeneralPE = item.QGeneralPE, QGeneralPEText = item.QGeneralPEText, QPEText = item.QPEText, QRespiratoryPE = item.QRespiratoryPE, QRespiratoryPEText = item.QRespiratoryPEText }; var isPhysicalExamination = physicalExamination.GetType().GetProperties() .Where(p => p.GetValue(physicalExamination) is string) .Select(p => (string)p.GetValue(physicalExamination)) .Any(value => !String.IsNullOrEmpty(value)); var specialNote = new SpecialNote() { QSpecialNote = item.QSpecialNote }; var model = new PhysicalExamAntiAgingViewModel() { ID = item.ID, QUESPAAdmDR = item.QUESPAAdmDR, QUESPAPatMasDR = item.QUESPAPatMasDR, QUESDate = item.QUESDate, QUESTime = item.QUESTime, History = history, IsHistory = isHistory, Genetic = genetic, IsGenetic = isGenetic, FamilyHistory = familyHistory, IsFamilyHistory = isFamilyHistory, PhysicalExamination = physicalExamination, IsPhysicalExamination = isFamilyHistory, SpecialNote = specialNote, QDoctor = item.QDoctor, QUESUserDR = item.QUESUserDR }; results.Add(model); } return(results); }