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;

  1. It should be possible to record ages in different ways (see above examples) ,
  2. In some cases it would be easier to record age as a DATE (Example: when reading a report of syndrome diagnose),
  3. Experts have (some times) the desire to see if a age was approximate or exact,
  4. The family would like to see the Age exactly as entered; so the system should always exactly reproduce the input,
  5. The recording should be easy
  6. The WaihonaPedia should, at some time, be able to do plausibility check (e.g. is it a correct age?),
  7. If dates, month-nanes must be displayed localization needs to be in place to show these words in the context.localization
  8. ...

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)

UIX Wireframe

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
I’d use Joda Time ($xwiki.jodatime).
See http://extensions.xwiki.org/xwiki/bin/view/Extension/Joda+Time+Plugin
jodatime to find out all its API (it’s quite rich).

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  

About the website contents

 

All of the information on this WebSite is for education purposes only. The place to get specific medical advice, diagnoses, and treatment is your doctor. Use of this site is strictly at your own risk. If you find something that you think needs correction or clarification, please let us know at: 

Send a email: wiki@waihonapedia.org