Implement US-10 on-demand health insights
This commit is contained in:
1 parent
4cb6798ec9
commit
a5b269cfc3
25 files changed
+482
-4
No files matched your search
@@ -0,0 +1,17 @@
|
||||
using InsightsService.Contracts;
|
||||
|
||||
namespace InsightsService.Domain;
|
||||
|
||||
public sealed class InsightCalculator
|
||||
{
|
||||
public HealthInsight? CalculateSummary(Guid patientId, DateTime from, DateTime to,
|
||||
IReadOnlyList<ObservationDto> observations)
|
||||
{
|
||||
if (observations.Count == 0)
|
||||
return null;
|
||||
return new HealthInsight(patientId, from, to,
|
||||
observations.Average(o => (decimal)o.Systolic), observations.Average(o => (decimal)o.Diastolic),
|
||||
observations.Average(o => (decimal)o.Pulse), observations.Min(o => o.Systolic),
|
||||
observations.Max(o => o.Systolic), observations.Min(o => o.Diastolic), observations.Max(o => o.Diastolic));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user