Datatype Age
Age, in WaihonaPedia, is always related to birth date and could is stored as:
- Number of days since/prior to birth
note: 'prior to birth' would only be relevant when describing something of the pregnancy or family planning, and can be ignored
It will be possible to record and view AGE as a combination of:
- Example: age recorded as Years,Months and Days (Exact age)
- Example: age recorded as Days (Exact age)
- Example: age recorded as a Date (Exact age)
- Example: age recorded as Years,Months,weeks (Approx age)
- Example: age recorded as Years,Months (Approx age)
- Example: age recorded as Years (Approx age)
- Example: age recorded as Months (Approx age)
We have the following functional requirements;
- It should be possible to record ages in different ways (see above examples) ,
- In some cases it would be easier to record age as a DATE (Example: when reading a report of syndrome diagnose),
- Experts have (some times) the desire to see if a age was approximate or exact,
- The family would like to see the Age exactly as entered; so the system should always exactly reproduce the input,
- The recording should be easy
- The WaihonaPedia should, at some time, be able to do plausibility check (e.g. is it a correct age?),
- If dates, month-nanes must be displayed localization needs to be in place to show these words in the context.localization
- ...
Database design considerations
We will store AGE in Numeric, relative to Date-of-birth ways or a DATE ,to use a primitive (simple) data-types; Number(integers) .
- Number (Integer)
- It would be important to store a Duration unit as Days.Note that months do not all have the same number of days, so a smart algorithm must be used (JoDaDate-Time) . A small error with numbers could result from daylight saving protocols that are different in some countries.
- Date
- Although the age is relative to birth date we could store the resulting date.
How to program consideration's
The AGE recording can be programmed in different languages, we will use:
- Velocity (scripting)(server side) with help of Groovy for some server-side algorithm .
Velocity
Link to JoDa Time...
Propositions
Numeric Days relative to date-of-birth
Record an age in days(integer)
Note that we want serverside storage of NumericDays.
But the user will be helped with a nice control (in Edit mode) where we can control the display of the accuracy by setting a option in a sheet (parameter Accuracy: Most, Month or Year)
The user will be further supported by Context analysis of BirthDate versus Current date.
If very young the Year part in the control could dissappear, except when accuracy is set to Year
The control, can be set to Show suggestion (Yes/No) If Suggestion = 'yes' then the context numbers can be profiled and allow to be overwritten by users
In read mode the output text will show similar but the box of the control will dissapear.
DATE recording
Note that this is not yet documented how to use a good calendar control
(out-of-scope first quarter of 2017)
velocity date tool demo
Recommendation of Vincent Massol, CTO of XWIKI
Below I've pasted examples from above examples page...
First day of the current week is Monday, May 13, 2024
Last day of the current week is Sunday, May 19, 2024
Document created on 08/11/2016 at 04:25
189 days left till my birthday!
Tomorrow is 2029-03-31T00:00:00.000+02:00!
Adding 1 month is 2029-04-30T00:00:00.000+02:00!
February 05 at 16:23