ICTatRTI / coconut-mobile-plugin-zanzibar

Plugins added to Coconut Mobile for project specific features
Other
0 stars 0 forks source link

Head of Household not transferred from Facility to Household record #19

Closed gmcressman closed 4 years ago

gmcressman commented 6 years ago

When a Household record is created, Head of Household name is not transferred from the matching Facility record.

gmcressman commented 6 years ago

Same issue with the following field: Contact Mobile # (patient/relative)

scloo commented 6 years ago

@mikeymckay I noticed the inconsistency in the naming of the attributes for the Facility questions. in some doc it is spelled as ContactMobilepatientrelative, while in others it is spelled ContactMobilePatientRelative. Likewise for 'HeadOfHouseholdName' and 'HeadofHouseholdName'.

I think causes issue in createHousehold() in the plugin Case. And the Head of Household Name and the Contact Mobile Patient Relative are not saved to the Household question.

scloo commented 6 years ago

@mikeymckay I suspect that the Form2jsPlugins that you introduced in the plugin, converts the attribute names to camelize form that is inconsistent with previous Facility question docs that do not use camelize form in the attribute names. And I suspect that the other questions are also affected similarly.

In Case.coffee - createHousehold(), you have HeadofHouseholdName: @Facility.HeadofHouseholdName ContactMobilepatientrelative: @Facility.ContactMobilepatientrelative

Attribute @Facility.HeadofHouseholdName does longer exist as you have already camelize to @Facility.HeadOfHouseholdName when saving the completed Facility question.

mikeymckay commented 6 years ago

Yes - the previous version used a simple hand-made camelcase, which wouldn't capitalize every word. The problem was that it also created invalid couchdb ids if the question name had a strange character in it. So in order to fix this Coconut Mobile now uses slugify to create safe names. In order to support backwards compatibility with Coconut Surveillance I have added a filter to form2js (via a plugin) which attempted to get the attributes into the same format as was used in the original Coconut Surveillance. Seems like this is broken in a few places. I think that the best thing to do will be to update the plugin to handle these cases.

On Fri, Nov 17, 2017 at 10:50 PM, Steve Loo notifications@github.com wrote:

@mikeymckay https://github.com/mikeymckay I suspect that the Form2jsPlugins that you introduced in the plugin, converts the attribute names to camelize form that is inconsistent with previous Facility question docs that do not use camelize form in the attribute names. And I suspect that the other questions are also affected similarly.

In Case.coffee - createHousehold(), you have HeadofHouseholdName: @Facility.HeadofHouseholdName ContactMobilepatientrelative: @Facility.ContactMobilepatientrelative

Attribute @Facility.HeadofHouseholdName does longer exist as you have already camelize to @Facility.HeadOfHouseholdName when saving the completed Facility question.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ICTatRTI/coconut-mobile-plugin-zanzibar/issues/19#issuecomment-345348656, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAu71nUeMAE9bfwmJJ5r4Ce8k_88fPlks5s3eOSgaJpZM4QiUCK .

scloo commented 6 years ago

@mikeymckay I see that you have made changes (Nov 25 in plugin codes) that took care of the camel case to HeadOfHouseHoldName. That solves the issue in Facility results view that was missing the Head of House Name. However in the Household result view, the data is still missing for Head Of Household Name and Total Number of Residents in the Household. Does this have anything to do with the fact that in the Case doc, the attributes are still in the old format "HeadofHouseholdName"? Screen Shot 2017-12-05 at 4.18.13 PM.png

gmcressman commented 6 years ago

Tested. Fixed. @scloo - Does the problem in your Dec 5 comment on this issue still exist?