public PatientDataResult evaluate(RowPerPatientData patientData, EvaluationContext context) throws EvaluationException { CustomCalculationBasedOnMultiplePatientDataDefinitions pd = (CustomCalculationBasedOnMultiplePatientDataDefinitions) patientData; List<Mapped<RowPerPatientData>> definitions = pd.getPatientDataToBeEvaluated(); List<PatientDataResult> results = new ArrayList<PatientDataResult>(); for (Mapped<RowPerPatientData> def : definitions) { RowPerPatientData data = def.getParameterizable(); data.setPatient(pd.getPatient()); data.setPatientId(pd.getPatientId()); def.setParameterizable(data); PatientDataResult patientDataResult = Context.getService(RowPerPatientDataService.class).evaluate(def, context); results.add(patientDataResult); } if (pd.getCalculator() != null) { PatientDataResult result = pd.getCalculator().calculateResult(results, context); result.setDefinition(patientData.getDescription()); result.setName(patientData.getName()); result.setEc(context); result.setPatientData(patientData); return result; } return new NullResult(pd, context); }
/** * @return the indicator dataset definition from the report. There's only one of these dataset * definitions, so we store it in the dataset definition map with a default key. */ @SuppressWarnings("unchecked") public CohortIndicatorDataSetDefinition getIndicatorDataSetDefinition() { Mapped<CohortIndicatorDataSetDefinition> mappedDataSetDefinition = (Mapped<CohortIndicatorDataSetDefinition>) getDataSetDefinitions().get(DEFAULT_DATASET_KEY); if (mappedDataSetDefinition != null) { return mappedDataSetDefinition.getParameterizable(); } return null; }