Skip to content

Conversation

@mradamcox
Copy link
Collaborator

Description of Change

Allow extended dates.

  • for any nodes that will hold extended date values, the business table name must be string
  • these nodes will have a free text input in the forms, and valid date values will be
    YYYY-MM-DD as before, YYYY-MM, or YYYY.
  • to enter a BCE date, just precede the date with -. For example, -44-03-15 or -12000.
  • all dates are now indexed into two new ES mappings extendeddates and extendeddategroups, where they are stored as integers
  • the time-filter works as before, now querying the new ES mappings instead of the old dates and date_groups mappings.

Issues Solved

#31

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

to test

  1. run pip install -r requirements.txt to install the new edtf python requirement
  2. change the businesstablename from dates to strings if you have the ARCHAEOLOGICAL_TO_DATE.E61 and ARCHAEOLOGICAL_FROM_DATE.E61 loaded.
    image
  3. run python manage.py packages -o index_database --resources if you already have resources loaded.

@azerbini
Copy link
Owner

Could you explain in what order the time filter arranges these two dates, if the mapping is an integer type?

-44-03-01
-44-04-01

Which one goes first?

Another question re: validation: does the js validation apply to the new string dates?

@mradamcox
Copy link
Collaborator Author

mradamcox commented Jun 28, 2018

The integers are calculated by first multiplying the year by 10,000 (to add four zeros to the end of it) and then adding the concatenation of mm-dd.

-44*10000 + 0301 = -439699
-44*10000 + 0401 = -439599

-439599 > -439699 so -44-04-01 > (later than) -44-03-01

You can see it here https://github.com/legiongis/arches/blob/EAMENA-31-extended-dates/arches/app/utils/date_utils.py#L4, and I took the basic concept from Arches 4 here https://github.com/archesproject/arches/blob/master/arches/app/utils/date_utils.py#L88.

As for js validation, yes, there is a new function that is applied only to edtf dates: https://github.com/legiongis/arches/blob/EAMENA-31-extended-dates/eamena/eamena/media/js/views/forms/sections/validation.js#L74

Signed-off-by: adam cox <mr.adamcox@gmail.com>
Signed-off-by: adam cox <mr.adamcox@gmail.com>
@mradamcox
Copy link
Collaborator Author

@michaeltfisher I think it's reasonable that we close this pull request without merging it. Extended dates integration is something we'll be able to have by default in v4, and the level of effort required to implement the changes needed for this are not worth it with the imminent v3-v4 migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants