public bool ApplyAnswerToSignature(QuSignature signature, string symptomName, Answer answer) { Answer.QUESTION_SICKNESS_LEVEL minRequiredSicknessLevel = signature.symptoms[symptomName].min_durere; Answer.QUESTION_SICKNESS_LEVEL maxRequiredSicknessLevel = signature.symptoms[symptomName].max_durere; Answer.QUESTION_SICKNESS_LEVEL answerValue = answer.GetAnswerSicknessLevel(); if (answerValue >= minRequiredSicknessLevel && answerValue <= maxRequiredSicknessLevel) { signature.currentPositiveScore += signature.symptoms[symptomName].importanta; return(true); } signature.currentScore -= signature.symptoms[symptomName].importanta; return(false); }
public bool ApplyAnswerToSignature(QuSignature signature, string symptomName, Answer answer) { bool requiredAnswer = signature.symptoms[symptomName].valoare; bool answerValue = answer.GetAnswerBoolean(); if (requiredAnswer == answerValue) { signature.currentPositiveScore += signature.symptoms[symptomName].importanta; return(true); } signature.currentScore -= signature.symptoms[symptomName].importanta; return(false); }
public bool ApplyAnswerToSignature(QuSignature signature, string symptomName, Answer answer) { float minRequiredAnswer = signature.symptoms[symptomName].min; float maxRequiredAnswer = signature.symptoms[symptomName].max; float answerValue = answer.GetAnswerNumeric(); if (answerValue >= minRequiredAnswer && answerValue <= maxRequiredAnswer) { signature.currentPositiveScore += signature.symptoms[symptomName].importanta; return(true); } signature.currentScore -= signature.symptoms[symptomName].importanta; return(false); }
private void ParseJson(string json) { Dictionary <string, QuSymptom> symptoms; json = NormalizeJson(json); QuSignature quSignature = new QuSignature(); quSignature = JsonConvert.DeserializeObject <QuSignature>(json); quSignature.ComputeInitialScore(); foreach (var item in quSignature.symptoms) { if (item.Value.tip == QuSymptom.SymptomTypes.NIVEL_DURERE) { item.Value.min_durere = DurereNumToEnum((int)(item.Value.min)); item.Value.max_durere = DurereNumToEnum((int)(item.Value.max)); } } // QuSignature quSignature = new QuSignature(symptoms); // quSignature.symptoms = symptoms; signatures.Add(quSignature); // Console.WriteLine(symptoms["glicemie"].tip); }