public void ContinuousNodeEnterValue(string nodeID, string databaseFieldName, Guid encounterID, ContinuousChanceNode cNode, List<aModifyCpnValue> aModifyCpnValueList, List<aModifyType> aModifyTypeList, SepsisFinder sepsisInfo) { PropertyInfo result = sepsisInfo.GetType().GetProperties().Where(x => x.Name.Equals(databaseFieldName, StringComparison.OrdinalIgnoreCase)).SingleOrDefault(); //If result is null, don't enter anything into the current node if (result.GetValue(sepsisInfo, null) != null) { tSepsisPresentation tSepsisPresentationLookup = (from c in _treatSepsisContext.tSepsisPresentation where c.EncounterID.Equals(encounterID) select c).SingleOrDefault(); List<ktTempSite> ktTempSite = (from c in _treatSepsisContext.ktTempSite select c).ToList(); float value = (float)result.GetValue(sepsisInfo, null); //Read value to be entered for current continuous node //Find all modifier for current node List<aModifyCpnValue> modifiers = aModifyCpnValueList.Where(x => x.NodeID.Equals(nodeID)).OrderBy(x => x.Order).ToList(); //Apply modifier value = ApplyModifiersOnValue(value, modifiers, aModifyTypeList, tSepsisPresentationLookup, ktTempSite); cNode.EnterValue(value); } }
public bool DiscreteNodeInitializeStates(string nodeID, string databaseFieldName, DiscreteChanceNode dNode, SepsisFinder sepsisInfo, List<aDiscreteNodeRange> aDiscreteNodeRangeLookUpList, List<aDiscreteNodeLookup> aDiscreteNodeLookUpList) { //Find the right property to read a value from by databaseFieldName PropertyInfo result = sepsisInfo.GetType().GetProperties().Where(x => x.Name.Equals(databaseFieldName, StringComparison.OrdinalIgnoreCase)).SingleOrDefault(); //If value is null, don't initialize anything on the current node if (result.GetValue(sepsisInfo, null) != null) { string nodeState = null; //Check if discrete node is standard if (aDiscreteNodeLookUpList.Exists(x => x.NodeID.Equals(nodeID))) { byte value = (byte)result.GetValue(sepsisInfo, null); //Standard use byte nodeState = GetStateToInitDNodeStandard(nodeID, value, aDiscreteNodeLookUpList); //Find state on discrete node to initialize - standard } //Check if discrete node is range else if (aDiscreteNodeRangeLookUpList.Exists(x => x.NodeID.Equals(nodeID))) { float value = (float)result.GetValue(sepsisInfo, null); //Range use float nodeState = GetStateToInitDNodeRange(nodeID, value, aDiscreteNodeRangeLookUpList); //Find state on discrete node to initialize - range } //In some cases, a value might not be mapped to any node state. In that case, skip if (nodeState == null) { return false; } //Enter findings (evidence) in discrete node DiscreteNodeEnterFindings(dNode, nodeState); return true; } return false; }