Merge and aggregate datasets: Difference between revisions
Content added Content deleted
Line 981: | Line 981: | ||
new Visit("1001", "2020-11-19", 5.3) ); |
new Visit("1001", "2020-11-19", 5.3) ); |
||
Collections.sort(patients, Comparator.comparing(Patient::patientID)); |
Collections.sort(patients, Comparator.comparing(Patient::patientID)); |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
List<Visit> patientVisits = visits.stream().filter( v -> v.visitID == patient.patientID() ).toList(); |
List<Visit> patientVisits = visits.stream().filter( v -> v.visitID == patient.patientID() ).toList(); |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
double scoreSum = statistics.getSum(); |
double scoreSum = statistics.getSum(); |
||
double scoreAverage = statistics.getAverage(); |
double scoreAverage = statistics.getAverage(); |
||
String patientDetails = String.format("%12s%11s%13s%12.2f%12.2f", |
String patientDetails = String.format("%12s%11s%13s%12.2f%12.2f", |
||
patient.patientID, patient.lastName, lastVisit, scoreSum, scoreAverage); |
patient.patientID, patient.lastName, lastVisit, scoreSum, scoreAverage); |
||
System.out.println(patientDetails); |
System.out.println(patientDetails); |
||
} |
} |
||
Line 1,010: | Line 1,002: | ||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{{ out }} |
{{ out }} |