medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
468 stars 217 forks source link

Inconsistent date format in replication date in info docs. #6364

Open 1yuv opened 4 years ago

1yuv commented 4 years ago

Describe the bug There is inconsistency in the way latest_replication_date or initial_replication_date field is written in info doc. In some of the documents, it's written in full Date/Time format while other documents have it written in unix stamp.

To Reproduce It was difficult to reproduce the scenario. But, for sms projects deployed with version 3.7.1 or above, latest_replication_date or initial_replication_date are written in date format for some info records and are written in unix stamp for other info records.

Expected behavior We should write these field in uniform format across all -info documents.

Environment

Additional context Add any other context about the problem here. What have you tried? Is there a workaround?

garethbowen commented 4 years ago

Related: https://github.com/medic/cht-core/issues/5912

I'm not sure why there would be inconsistency here.

We should decide which is the "correct" format to use and migrate to use that throughout the database. Using the unix stamp is good because it's simple, small to store, and easy to validate. Using the string full datetime format is nice because it's human readable.

@yrimal Which do you prefer?

1yuv commented 4 years ago

Hi @garethbowen , Since reported_date field in other doc are already in unix stamp, it'll be easier to change just in -info doc to store them as unix stamp. Like you mentioned I like minimal size and easier validity of this over full date time format.