cht-core icon indicating copy to clipboard operation
cht-core copied to clipboard

Force form "internalId" to match database ID

Open alxndrsn opened this issue 8 years ago • 14 comments

Having two different IDs is a minefield. If we can force (perhaps at form-upload time) that these values match, it will simplify things.

This may be best done at form upload time.

alxndrsn avatar Apr 05 '17 08:04 alxndrsn

Turns out that fixing this will fix #3390

alxndrsn avatar Apr 19 '17 15:04 alxndrsn

Would be nice to preserve URLs like http://localhost:5988/medic/_design/medic/_rewrite/#/reports/add/pregnancy, instead of http://localhost:5988/medic/_design/medic/_rewrite/#/reports/add/form:pregnancy

Seems like it might be nice to have both, but ensure (somewhere) that they are equal. Perhaps one can be generated from the other during doc upload, or as part of view generation or inside the angular service which fetches the forms from pouch.

alxndrsn avatar Apr 19 '17 17:04 alxndrsn

@abbyad when uploading an XForm, do you ever set the internalId of a form different to the doc ID (minus the form: prefix? I'm thinking of mandating that they match in the upload script.

alxndrsn avatar Apr 27 '17 01:04 alxndrsn

If we mandate that, please make sure to note that in the Migration Notes section of the changelog so that it is highlighted for tech leads.

sglangevin avatar Apr 28 '17 16:04 sglangevin

This is already being enforced by the convert.sh script in medic-projects, so perhaps not a controversial change at all.

alxndrsn avatar May 04 '17 09:05 alxndrsn

Currently, form doc IDs must be lower-case, but the ID in XML can contain upper-case chars: https://github.com/medic/medic-webapp/blob/master/ddocs/medic-client/validate_doc_update.js#L16-L33

alxndrsn avatar May 06 '17 05:05 alxndrsn

I think this is a good goal for the longer-term, but the work required migrating current projects is not justified currently.

alxndrsn avatar May 06 '17 05:05 alxndrsn

Not a priority - moving out of iteration.

garethbowen avatar May 09 '17 21:05 garethbowen

Highlighting that we need to fix and test contact forms with respect to this issue.

Currently we get: WARN DEPRECATED Form: clinic-create.xml Bad ID set in XML. Expected: contact:clinic:create but saw: clinic_create Support for setting these values differently will be dropped. Please see https://github.com/medic/medic-webapp/issues/3342.

Need to verify that changing the ID to resolve the warning does not remove the special considerations for contact forms.

abbyad avatar Jul 25 '17 15:07 abbyad

I've already tested this with contact forms and they were fine. I changed the ID to match the internal ID and had no issues.

sglangevin avatar Jul 25 '17 15:07 sglangevin

Great, I'll update the Standard config forms accordingly.

abbyad avatar Jul 25 '17 15:07 abbyad

Hi @SCdF,

This ticket has not been touched in 90 days. Is it still relevant?

Please also ensure this ticket has a Priority, Status and Type label.(See triaging old issues for more detail)

medic-bot avatar May 23 '18 16:05 medic-bot

Sounds like a nice change to do at some point

SCdF avatar May 31 '18 10:05 SCdF

Scheduling for consideration in the next major.

garethbowen avatar May 09 '19 17:05 garethbowen