Cht-core: Sentinel scheduling EDDs on a Sunday for all ANC registrations

Created on 20 Jun 2017  路  16Comments  路  Source: medic/cht-core

Before V2, all EDDs fell on a Sunday but it was not apparent because the shown EDD did not include the day of the week was not indicated e.g 2017-11-13

But now the EDD includes the day of the week e.g Sun, Aug 6th, 2017. See below screenshots.

ancp1
ancp2
ancp3

This has been confusing the partners as they feel the calculation involved may not really be accurate as it should be.
See the issue as reported on medic-projects https://github.com/medic/medic-projects/issues/2232

The suggestion is that the date formatting could be changed to NOT have the day of the week i.e Sun, or the Sentinel code could be changed to remove the specification for startOf('week'); and instead just calculate from the exact provided date so that the EDD is an exact addition from the stated LMP.

Sentinel Bug

Most helpful comment

LGTM. EDD is now scheduled based on the day the pregnancy registration is submitted.

All 16 comments

@billwambua I have removed the screenshots.

I was just a part of a call discussing this with the partner. The issue with making it on Sunday, even though it's an approximation and we're referring to the week, is that since doctors don't get in on Sundays and they are instead on call. Instead, they propose choosing Wednesday of that week. Tagging @sglangevin

@henokgetachew @billwambua I would have liked to finish this discussion in medic-projects before moving this issue over. Thanks @henokgetachew for removing the screenshots.

To me, this sounds like a partner-specific issue but I also imagine that most other clinics are not staffed on Sundays. The problem is that we are collecting "weeks since LMP" so we don't know exactly which day the last period started, which means calculating the EDD using LMP + 280 days would also not be accurate.

And finally, before we were to choose a random day like Wednesday, I'd like to get feedback from other partners on what their preferences are. I was thinking that Monday would make more sense since it's the start of the week and might work better across the board.

Do we have other partners that we can talk to who can give their opinions on this? Or perhaps @aikajanet or @katanu have opinions?

This is configurable per project either through the UI at /configuration/settings/advanced or via app_settings properties date_format (for dates) and reported_date_format (badly named, but for datetimes).

@garethbowen is the configuration for how we are displaying the date or can we actually choose which day of the week the EDD falls on?

@henokgetachew I was just talking about the part about removing Sunday from the output, but it looks like that's known already. Choosing which day of the week the EDD falls on is not configurable.

Yeah, that was my understanding as well. That was our second proposal to them: just changing the format to not show the day of the week.

@garethbowen we can't configure which day of the week the EDD falls on but can we configure to not have if fall on the start of the week but on the exact day calculated? The reminders are sent on the exact day so I would assume it is possible to calculate the EDD similarly?

We have had partners be confused here in Nepal as well ( @PawanMM can comment more) because of this same issue. However, I want to clarify that it is not specifically because it's a Sunday but because its rounded off (referring to what Henok mentioned re doctors not being on regular duty then, and I agree with Sharon here that this preference of a particular day would be partner specific so should not be applied to our webapp as a general feature). I agree that EDD is not accurate regardless of how it is calculated but the fact that we are basing it off of 'weeks since LMP' the users are already rounding it off once (before data is sent). If we configure to have it fall only on Sunday or a particular day of the week, we are rounding it off once more which makes it harder for our partners to trust the date.

Changing the date format to not show the day of the week would be a bandaid solution that would only work with new partners that haven't yet noticed this.

@ranjuts I completely agree. The code to round down to the start of the week was added about four years ago and I have no idea what the rationale was. Unfortunately it is hardcoded into sentinel. For now the bandaid solution is all I've got.

@sglangevin I think we should remove the rounding code in 2.13.0. I'm a little concerned that someone may be relying this behaviour as it's been part of the app for so long. Can we ask around and find out?

I suspect nobody even realised this was happening and will be happy with it being fixed.

Thanks Gareth. If this was done around four years ago @mandric might know what the rationale was? Perhaps @diannakane as well?

Yes a prehistoric choice indeed, made by Rowan in fact, probably according to the initial OHW project spec that spawned that feature. It's in one of the earliest commits of sentinel and the git history wasn't preserved (looks like a copy from kujua-lite) so there's not much to go on. I imagine it has something to do with calculations or analytics that are easier to do if you standardize on a week day that begins a week.
https://github.com/medic/medic-sentinel/blob/39a2914525e5dff825e665662b96528cfc2c0f87/transitions/ohw_registration.js#L28
https://github.com/medic/medic-sentinel/blob/39a2914525e5dff825e665662b96528cfc2c0f87/test/unit/ohw_registration.js#L46

@garethbowen I'd like to finish the other priorities that are already in 2.13.0 - several items are still not complete. I had planned to schedule this one for 2.14.0 so that we could also handle any changes needed to message scheduling per our conversation on Slack.

Ok. I'll add this to the 2.14.0 project. Should be a quick fix.

Assigning to myself for AT.

AT blocked on #3894.

LGTM. EDD is now scheduled based on the day the pregnancy registration is submitted.

Was this page helpful?
0 / 5 - 0 ratings