Implement US-11 context-aware health trend assessments
This commit is contained in:
1 parent
a0a9e2e9b9
commit
cc76c9bde4
9 files changed
+802
-7
No files matched your search
@@ -18,6 +18,18 @@ public sealed class InsightsApplicationService(ObservationServiceClient observat
|
||||
return calculator.CalculateSummary(patientId, from, to, history, selection);
|
||||
}
|
||||
|
||||
public async Task<TrendAssessment> GetTrendAsync(Guid patientId, DateTime from, DateTime to,
|
||||
ContextSelection selection, CancellationToken cancellationToken)
|
||||
{
|
||||
from = NormalizeTimestamp(from);
|
||||
to = NormalizeTimestamp(to);
|
||||
if (to < from)
|
||||
throw new ArgumentException("The end time must not be earlier than the start time.", nameof(to));
|
||||
Validator.ValidateObject(selection, new ValidationContext(selection), validateAllProperties: true);
|
||||
var history = await observations.GetByPeriodAsync(patientId, from, to, selection, cancellationToken);
|
||||
return calculator.CalculateTrend(patientId, from, to, history, selection);
|
||||
}
|
||||
|
||||
private static DateTime NormalizeTimestamp(DateTime value) =>
|
||||
DateTime.SpecifyKind(value.Kind == DateTimeKind.Unspecified ? value : value.ToUniversalTime(),
|
||||
DateTimeKind.Unspecified);
|
||||
|
||||
Reference in new issue
Block a user