Skip to content

Commit 819bb7b

Browse files
authored
chore(docs): update Therapy and Monitoring Manager documentation (#1774)
* chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation * chore(docs): update Therapy and Monitoring Manager documentation
1 parent 35a4dea commit 819bb7b

File tree

5 files changed

+76
-23
lines changed

5 files changed

+76
-23
lines changed

docs/runtime_suite/therapy-and-monitoring-manager/10_overview.md

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ For each prototype you need to define:
177177
- the name;
178178
- the schema;
179179
- the labels for the schema fields (**required** only if you use the TMM with the companion FE component);
180-
- the values for the schema fields (**required** only if you use the TMM with the companion FE component);
180+
- the values for the schema fields;
181181
- the hints for the schema fields (only for therapy directives, should provide a list of admitted or suggested values for a schema field).
182182
183183
TMM supports localization for `name`, `labels` and `hints`, using a syntax like the following (`en` is ISO 639-1 language code for English, `it` for Italian):
@@ -423,48 +423,86 @@ The integrated validation system currently supports the following threshold vali
423423
}
424424
```
425425

426-
:::warning
426+
:::danger
427+
428+
The integrated validation system is designed under two assumptions.
429+
430+
- The property of the detection referred by a threshold contains one or two numeric values; if the value is not a number or an array of two numbers, depending on the operator, an error is returned.
431+
- The `propertyName` is treated as the path of the field in the detection containing the value to compare against the threshold, unless a different path is specified under prototype `values`; see the next section for more information.
432+
433+
:::
434+
435+
Additional information about the API requirements and the setup of the external validation service are available in the [*Configuration* section][thresholds-validation].
436+
437+
### Threshold evaluation
438+
439+
When a detection is submitted, its value is checked against each threshold defined in the associated monitoring plan.
427440

428-
The value of the `propertyName` should be the path to the value of the specific attributes in the prototype schema. If your schema is not a plan object you can use the `values` on the prototype to specify the path.
429-
Here you can find the examples:
441+
In this context, the threshold `propertyName` is treated as the path of the field in the detection `value` object containing the numeric value to be validated.
442+
443+
So, given a threshold looking like this:
444+
445+
```json
446+
{
447+
"propertyName": "systolicBloodPresure",
448+
"thresholdOperator": "gt",
449+
"thresholdValue": 130
450+
}
451+
```
452+
453+
and a detection looking like this:
430454

431-
- If you have a plane object the `propertyName` will be simply equal to that record like `systolicBloodPresure` or `diastolicBloodPresure`.
432455
```json
433456
{
434457
"systolicBloodPresure": 120,
435-
"diastolicBloodPresure": 66
458+
"diastolicBloodPresure": 75
436459
}
437460
```
438461

439-
- If you have a a complicated schema the `propertyName` should be equal to that path of the value like `observations[0].value` for `systolicBloodPresure` and `observations[1].value` for the value of `diastolicBloodPresure`.
462+
the TMM can assert that the `systolicBloodPresure` has a safe value, since `120` is lower than `130`.
463+
464+
If your schema is not a plain object, but for example has array and/or nested fields, we recommend using the `values` field on the prototype to map the `propertyName` to the actual `path` and make the prototype configuration more human readable.
465+
466+
So, given the same threshold as before and a detection looking like this:
467+
440468
```json
441469
{
442470
"period": {
443-
"startDate": "2024-01-01"
471+
"start": "2024-01-07T19:10:00Z",
444472
},
445473
"observations": [
446474
{
447-
"code": "systolicBloodPresure",
475+
"name": "Diastolic blood pressure",
448476
"unit": "mmHg",
449-
"value": 120
477+
"value": 75
450478
},
451479
{
452-
"code": "diastolicBloodPresure",
480+
"name": "Systolic blood pressure",
453481
"unit": "mmHg",
454-
"value": 66
482+
"value": 120
455483
}
456484
]
457485
}
458486
```
459-
:::
460487

461-
:::danger
488+
you can add the following `values` to the prototype:
462489

463-
The integrated validation system is designed under the assumption that the property of the detection value referred by a threshold contains one or two numeric values. If the value is not a number or an array of two numbers, depending on the operator, an error is returned.
490+
```json
491+
{
492+
"values": {
493+
"diastolicBloodPresure": {
494+
"path": "observations[0].value"
495+
},
496+
"systolicBloodPresure": {
497+
"path": "observations[1].value"
498+
}
499+
}
500+
}
501+
```
464502

465-
:::
503+
which is basically a way to tell the TMM that the values of the `diastolicBloodPresure` and `systolicBloodPresure` properties can be found in the `value` field of the first and second object inside the `observations` array field, respectively.
466504

467-
Additional information about the API requirements and the setup of the external validation service are available in the [*Configuration* section][thresholds-validation].
505+
When the TMM needs to compare a detection against a thresholds, it first performs a lookup on the prototype `values` based on the threshold `propertyName`: if there is a match, like in our example for `systolicBloodPresure`, the TMM gets the value from the detection at the path specified in the `path` field of the prototype value (in our case `observations[1].value`).
468506

469507
## Notifications
470508

docs/runtime_suite/therapy-and-monitoring-manager/20_configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Note that, modifying an identifier in an already running system can lead to inco
182182

183183
* **Labels**: the labels for the schema fields, each one can be a string or translation object.
184184

185-
* **values**: the values for the schema fields, each one must be an object containing the path of the field in the detection value containing the corresponding value to compare against the thresholds.
185+
* **Values**: the values for the schema fields, each one must be an object containing the path of the field in the detections containing the value to compare against the thresholds.
186186

187187
* **Hints**: the hints for the schema fields, each one can be a string or translation object. This is only supported by therapy directives, to provide a list of admitted or suggested values for the field.
188188

@@ -348,12 +348,12 @@ By default, the TMM does not validate detections against the thresholds. If you
348348

349349
- set the TMM **VALIDATION_SERVICE** [environment variable][environment-variables] to `internal` or `external`;
350350
- if you are using an external service:
351-
- deploy a custom microservice exposing a HTTP API following the specifications provided in the [section below][external-validation-service-api];
351+
- deploy a custom microservice exposing a HTTP API following the specifications provided in the [section below][external-validation];
352352
- set the TMM **VALIDATION_SERVICE_URL** [environment variable][environment-variables] to the HTTP(s) address of your service (both public and internal cluster URLs will work).
353353

354-
### External Validation Service API
354+
### External validation
355355

356-
The External Validation Service must expose the following endpoints:
356+
The External validation relies on a service exposing an HTTP interface with the the following endpoints:
357357

358358
- `POST /validations/` to validate a detection against the monitoring thresholds.
359359

@@ -405,6 +405,6 @@ The TMM currently generates the following events you can refer in the configurat
405405
[crud-detections]: #detections "Detections | CRUD collections | Configuration"
406406
[crud-monitorings]: #monitorings "Monitorings | CRUD collections | Configuration"
407407
[environment-variables]: #environment-variables "Environment variables | Configuration"
408-
[external-validation-service-api]: #external-validation-service-api "External Validation Service API | Thresholds validation | Configuration"
408+
[external-validation]: #external-validation "External validation | Thresholds validation | Configuration"
409409

410410
[errors]: ./30_usage.md#errors

docs/runtime_suite/therapy-and-monitoring-manager/30_usage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The therapy data model add the concept of `directives`, which is an object follo
5858

5959
The monitoring data model add the concept of `notes` and `thresholds`. The notes field contains the physician prescriptions, while a threshold is an object with the following properties:
6060

61-
* `propertyName`: name of the property on which the threshold is evaluated;
61+
* `propertyName`: name of the property on which the threshold is evaluated; it should correspond to the path of the detection field containing the value to compare against the threshold, if your detection have nested or array fields you should specify the mapping between the `propertyName` and its path under the prototype `values` field (more details in the [Overview section][threshold-evaluation]);
6262
* `thresholdOperator`: operator to use in the threshold evaluation. Available options are: `gt`, `lt`, `gte`, `lte`, `eq`, `between`, `notBetween`;
6363
* `thresholdValue`: the value with which to evaluate the threshold (a single number for `gt`, `lt`, `gte`, `lte` and `eq` operators, an array of two numbers indicating a range for the `between` and `notBetween` operators).
6464

@@ -946,6 +946,7 @@ The computation is performed for each plan according to the following algorithm,
946946

947947
[overview]: ./10_overview.md "Overview page"
948948
[adherence-compliance]: ./10_overview.md#adherence-and-compliance "Adherence and compliance | Overview"
949+
[threshold-evaluation]: ./10_overview.md#threshold-evaluation
949950

950951
[configuration]: ./20_configuration.md "Configuration page"
951952
[environment-variables]: ./20_configuration.md#environment-variables "Environment variables | Configuration"

docs/runtime_suite/therapy-and-monitoring-manager/40_migration.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Instead, modify the source file and run the aggregator to regenerate this file.
1212

1313
This document provides information to migrate from a previous version of the service.
1414

15+
## 0.5.1
16+
17+
No change required from previous version.
18+
19+
If you use the [`ck-threshold-modal` Care Kit component][care-kit-ck-threshold-modal] and any of your prototypes includes the `values` field, please note that this version of the TMM is not compatible with Care Kit v2.9.0.
20+
1521
## 0.5.0
1622

1723
### CRUD collections
@@ -42,3 +48,5 @@ Add the following fields to the [detections CRUD collection][crud-detections]:
4248

4349
[crud-detections]: ./20_configuration.md#detections
4450
[crud-monitorings]: 20_configuration.md#monitorings
51+
52+
[care-kit-ck-threshold-modal]: /runtime_suite/care-kit/20_components/50_ck-threshold-modal.md

docs/runtime_suite/therapy-and-monitoring-manager/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ All notable changes to this project will be documented in this file.
1515
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1616
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1717

18+
## [0.5.1] 2024-11-12
19+
20+
### Fixed
21+
22+
- Convert thresholds `propertyName` according to prototype `values` when creating or updating a monitoring plan
23+
1824
## [0.5.0] 2024-10-30
1925

2026
### Changed

0 commit comments

Comments
 (0)