Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local time in CSV exports #773

Merged
merged 4 commits into from
Apr 17, 2019
Merged

Use local time in CSV exports #773

merged 4 commits into from
Apr 17, 2019

Conversation

rmartz
Copy link
Contributor

@rmartz rmartz commented Apr 17, 2019

Overview

Microsoft Excel and other applications generally have poor support for date times represented in ISO 8601, or even with any timezone suffix at all. Because CSV export is predominantly targeted towards users who will analyze the data in applications of that sort (As the API exists for more programatic usage where ISO 8601 would be more conventional), this removes the timezone from the date times in CSV export and formats them in a standard YYYY-MM-DD format using the configured timezone.

For consistency and data completeness this also adds a column including the timezone the dates are rendered in.

Checklist

  • PR has a descriptive enough title to be useful in changelogs

Demo

record_id,timezone,created,modified,occurred_from,occurred_to,lat,lon,location_text,city,city_district,county,neighborhood,road,state,weather,light,Hit & Run,Police Station,District,Type of Collision - Others (specify),Crash Severity,Type of Collision,State,Charges against - Other  (please specify),Crime Registration Number,driverIncidentDetails_id,Charges against,Type of Area
1590043d-3e47-4dca-a3e5-2d664d276b78,Asia/Calcutta,2019-03-07 16:39:41,2019-04-17 03:27:07,2019-01-31 20:25:00,2019-01-31 20:25:00,19.057719,72.92541,"Deonar Colony, M/E Ward, Mumbai, Mumbai Suburban, Maharashtra, 400088, India",Mumbai,None,None,Deonar Colony,None,Maharashtra,clear-night,night,No,Deonar,Mumbai,,Serious Injury,Vehicle to Pedestrian,Maharashtra,,37/2019,f25f85b3-f8c0-41ba-b8fc-9e3ac2eca6e0,"[u'184', u'279', u'338']",Urban

Notes

  • Tweaks a few instances where dictionary key lookups were duplicated to use .get() with the intention of streamlining the logic and marginally improve performance

Testing Instructions

  • Provision VMs to ensure that Celery processes are up to date and Django is set to use configured timezone
  • Open Map page
  • Filter so that some records are shown
  • Export and Download CSV
  • Open CSV file
    • Dates should be represented as YYYY-MM-DD HH:MM:SS, without timezone suffix
    • Timezone column should be included and match configured timezone
  • Open details list for a record in the CSV export (http://localhost:7000/#!/record/{Record UUID}/details
    • Times should match times in CSV export for that record

Closes PT164776646

@rmartz rmartz requested a review from kshepard April 17, 2019 15:35
Copy link
Member

@kshepard kshepard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Good cleanup too.

@rmartz rmartz merged commit da2d2da into develop Apr 17, 2019
@rmartz rmartz deleted the feature/local-timezone-csv branch April 17, 2019 17:56
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