# Time computations

Age, Reaction duration, Drug treatment duration and Time-To-Onset

These values are considered durations and are all calculated according to the same principles. If the actual value is not reported, a calculated duration from reported dates are shown.’

| Duration                | Start date        | Stop date           |
| ----------------------- | ----------------- | ------------------- |
| Patient age             | PatientBirthDate  | ReactionStartDate\* |
| Reaction duration       | ReactionStartDate | ReactionEndDate     |
| Drug treatment duration | DrugStartDate     | DrugEndDate         |
| Time-To-Onset           | DrugStartDate     | ReactionStartDate   |

\*When several reactions with different start dates are reported within the same case, the\
earliest date is used.

Each date is given a min and a max value (down to minute), see examples below:

| Date (reported) | Date min         | Date max         |
| --------------- | ---------------- | ---------------- |
| 2000            | 2000-01-01 00:00 | 2000-12-31 23:59 |
| 200001          | 2000-01-01 00:00 | 2000-01-31 23:59 |
| 20000101        | 2000-01-01 00:00 | 2000-01-01 23:59 |
| 2000010113      | 2000-01-01 13:00 | 2000-01-01 13:59 |
| 200001011334    | 2000-01-01 13:34 | 2000-01-01 13:34 |

Duration is calculated out of the min and the max dates and each duration is given a min, max\
and mean value.

Duration min is set to the time span between the highest possible start date and the lowest\
possible stop date (e.g. for Patient age it is ReactionStartDate min – PatientBirthDate max)\
Duration max is set to the time span between the lowest possible start date and the highest possible stop date (e.g. for Patient age it is ReactionStartDate max – PatientBirthDate min)\
Duration mean is set to (Duration min + Duration max) /2.

Durations are always rounded to nearest integer, except age which is rounded down. Duration\
mean is shown in VigiLyze, see examples below:

| Start date - Stop date    | Duration min | Duration max |             |
| ------------------------- | ------------ | ------------ | ----------- |
| 200406-2006               | 1.5 years    | 2.6 years    | 2 years     |
| 20050506 – 2011           | 5.7 years    | 6.7 years    | 6 years     |
| 20130617-201309           | 2.5 months   | 3.4 months   | <p>3 months |
| <br>2 months (if age)</p> |              |              |             |
| 19840108-19840111         | 2 days       | 4 days       | 3 days      |
| 19840108-19840108         | -1 day       | 1 day        | 0 days      |
| 20090511-20090530         | 18 days      | 20 days      | 19 days     |
| 201103-2011               | 3 months     | 10 months    | -\*         |
| 2005-2005                 | -12 months   | 12 months    | -\*         |
| 200105-200105             | -31 days     | 31 days      | -\*         |
| 20040903-200409           | -3 days      | 28 days      | -\*         |

\*If the uncertainty is high, i.e. difference between max and mean duration is more than 1.5,\
no duration is shown. This happens with incomplete dates that are close in time.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.who-umc.org/vigilyze/algorithms-used-in-vigilyze/time-computations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
