OpenClinica / enketo-oc

OpenClinica's fork of the Enketo web forms monorepo
Apache License 2.0
0 stars 1 forks source link

OC Only: unexpected 'Saving' #193

Open enketo-issue-mover opened 6 years ago

enketo-issue-mover commented 6 years ago

From @MartijnR on November 23, 2017 0:16

Steps:

  1. Open new form in Edit mode. Calculations save automatically.
  2. Close form.
  3. Open form in Edit mode.

Expected: No change are saved to the form just by opening it.

Actual: I see Saving... and then All changes saved as soon as I open the form again.

Copied from original issue: kobotoolbox/enketo-express#874

enketo-issue-mover commented 6 years ago

From @MartijnR on November 23, 2017 0:17

Probably related pyxform creating a calculation for repeat count (though that's actually not necessary and too verbose). See form Paul emailed on 11/22

enketo-issue-mover commented 6 years ago

From @MartijnR on November 23, 2017 18:44

This could also happen if e.g. the instanceID is not included in the record provided by OC to edit (But this one related to repeat count)

enketo-issue-mover commented 6 years ago

From @MartijnR on November 23, 2017 20:27

enketo-issue-mover commented 6 years ago

From @MartijnR on November 23, 2017 20:34

full XML record:

curl --user enketorules: -d "server_url=https://enketo-aggregate.appspot.com&form_id=vitals&instance=<demo-vitals-grid-v4 xmlns:enk=\"http://enketo.org/xforms\" xmlns:jr=\"http://openrosa.org/javarosa\" xmlns:oc=\"http://openclinica.org/xforms\" xmlns:orx=\"http://openrosa.org/xforms\" id=\"vitals\" version=\"4\"><page1><ins_note/><rndm>5</rndm><cohort>E</cohort><cohort_note/><temp_yn/><temp_group><temp/><temp_units/><temp_unit_des/><temp_entry/><temp_entry_hidden/><temp_comment oc:queryParent=\"temp\"/><temp_units_comment oc:queryParent=\"temp_units\"/><temp_entry_comment oc:queryParent=\"temp_entry\"/><temp_entry_hidden_comment oc:queryParent=\"temp_entry_hidden\"/></temp_group><wh_y/><wh_units/><weight/><weight_unit_des>weight not entered</weight_unit_des><height/><height_unit_des>height not entered</height_unit_des><calc_note/><bmi/><bmi_hidden/><bmi_calc>0</bmi_calc><bmi_ro/><bmi_rad/><resp_rate/><pulse/><temp_yn_comment oc:queryParent=\"temp_yn\"/><wh_y_comment oc:queryParent=\"wh_y\"/><wh_units_comment oc:queryParent=\"wh_units\"/><weight_comment oc:queryParent=\"weight\"/><height_comment oc:queryParent=\"height\"/><bmi_comment oc:queryParent=\"bmi\"/><bmi_hidden_comment oc:queryParent=\"bmi_hidden\"/><bmi_rad_comment oc:queryParent=\"bmi_rad\"/><resp_rate_comment oc:queryParent=\"resp_rate\"/><pulse_comment oc:queryParent=\"pulse\"/></page1><page2><bp_yn/><bp_note/><bp_rg_count>3</bp_rg_count><bp_rg enk:last-used-ordinal=\"3\" enk:ordinal=\"1\"><bp_rg_num_init/><bp_rg_num/><bp_row/><bp_pos/><bp_sys/><bp_sys_val/><bp_sys_count/><bp_dia/><bp_dia_val/><bp_dia_count/><bp_ratio/><bp_ratio_hidden/><bp_dt_prec/><bp_dt_ymd/><bp_dt_ym/><bp_dt_y/><date_note/><bp_row_comment oc:queryParent=\"bp_row\"/><bp_pos_comment oc:queryParent=\"bp_pos\"/><bp_sys_comment oc:queryParent=\"bp_sys\"/><bp_dia_comment oc:queryParent=\"bp_dia\"/><bp_ratio_comment oc:queryParent=\"bp_ratio\"/><bp_ratio_hidden_comment oc:queryParent=\"bp_ratio_hidden\"/><bp_dt_prec_comment oc:queryParent=\"bp_dt_prec\"/><bp_dt_ymd_comment oc:queryParent=\"bp_dt_ymd\"/><bp_dt_ym_comment oc:queryParent=\"bp_dt_ym\"/><bp_dt_y_comment oc:queryParent=\"bp_dt_y\"/></bp_rg><bp_rg enk:ordinal=\"2\"><bp_rg_num_init>1</bp_rg_num_init><bp_rg_num>1</bp_rg_num><bp_row>2</bp_row><bp_pos>Sitting</bp_pos><bp_sys/><bp_sys_val>0</bp_sys_val><bp_sys_count>0</bp_sys_count><bp_dia/><bp_dia_val>0</bp_dia_val><bp_dia_count>0</bp_dia_count><bp_ratio>0</bp_ratio><bp_ratio_hidden/><bp_dt_prec/><bp_dt_ymd/><bp_dt_ym/><bp_dt_y/><date_note/><bp_row_comment oc:queryParent=\"bp_row\"/><bp_pos_comment oc:queryParent=\"bp_pos\"/><bp_sys_comment oc:queryParent=\"bp_sys\"/><bp_dia_comment oc:queryParent=\"bp_dia\"/><bp_ratio_comment oc:queryParent=\"bp_ratio\"/><bp_ratio_hidden_comment oc:queryParent=\"bp_ratio_hidden\"/><bp_dt_prec_comment oc:queryParent=\"bp_dt_prec\"/><bp_dt_ymd_comment oc:queryParent=\"bp_dt_ymd\"/><bp_dt_ym_comment oc:queryParent=\"bp_dt_ym\"/><bp_dt_y_comment oc:queryParent=\"bp_dt_y\"/></bp_rg><bp_rg enk:ordinal=\"3\"><bp_rg_num_init>1</bp_rg_num_init><bp_rg_num>1</bp_rg_num><bp_row>3</bp_row><bp_pos>Lying</bp_pos><bp_sys/><bp_sys_val>0</bp_sys_val><bp_sys_count>0</bp_sys_count><bp_dia/><bp_dia_val>0</bp_dia_val><bp_dia_count>0</bp_dia_count><bp_ratio>0</bp_ratio><bp_ratio_hidden/><bp_dt_prec/><bp_dt_ymd/><bp_dt_ym/><bp_dt_y/><date_note/><bp_row_comment oc:queryParent=\"bp_row\"/><bp_pos_comment oc:queryParent=\"bp_pos\"/><bp_sys_comment oc:queryParent=\"bp_sys\"/><bp_dia_comment oc:queryParent=\"bp_dia\"/><bp_ratio_comment oc:queryParent=\"bp_ratio\"/><bp_ratio_hidden_comment oc:queryParent=\"bp_ratio_hidden\"/><bp_dt_prec_comment oc:queryParent=\"bp_dt_prec\"/><bp_dt_ymd_comment oc:queryParent=\"bp_dt_ymd\"/><bp_dt_ym_comment oc:queryParent=\"bp_dt_ym\"/><bp_dt_y_comment oc:queryParent=\"bp_dt_y\"/></bp_rg><bp_sys_mean/><bp_dia_mean/><bp_number/><bp_ratio_lookup/><likert_group><likert_note/><systolic_agreement/><diastolic_agreement/><systolic_agreement_comment oc:queryParent=\"systolic_agreement\"/><diastolic_agreement_comment oc:queryParent=\"diastolic_agreement\"/></likert_group><newselectitem/><newdecimal/><pain_level/><vas_question/><media_yn/><pic/><ecg_picture/><cascade1/><cascade2/><cascade3/><us_map/><image_map_note/><add_notes/><bp_yn_comment oc:queryParent=\"bp_yn\"/><bp_sys_mean_comment oc:queryParent=\"bp_sys_mean\"/><bp_dia_mean_comment oc:queryParent=\"bp_dia_mean\"/><bp_number_comment oc:queryParent=\"bp_number\"/><bp_ratio_lookup_comment oc:queryParent=\"bp_ratio_lookup\"/><newselectitem_comment oc:queryParent=\"newselectitem\"/><newdecimal_comment oc:queryParent=\"newdecimal\"/><pain_level_comment oc:queryParent=\"pain_level\"/><vas_question_comment oc:queryParent=\"vas_question\"/><media_yn_comment oc:queryParent=\"media_yn\"/><pic_comment oc:queryParent=\"pic\"/><ecg_picture_comment oc:queryParent=\"ecg_picture\"/><cascade1_comment oc:queryParent=\"cascade1\"/><cascade2_comment oc:queryParent=\"cascade2\"/><cascade3_comment oc:queryParent=\"cascade3\"/><us_map_comment oc:queryParent=\"us_map\"/><add_notes_comment oc:queryParent=\"add_notes\"/></page2><meta><instanceID>uuid:f9456003-e436-4751-b786-91c3608c347f</instanceID><instanceID_comment oc:queryParent=\"instanceID\"/></meta></demo-vitals-grid-v4>&instance_id=a" http://localhost:8005/api/v2/instance/fieldsubmission/iframe

without value for bp_rg_count (the issue can be reproduced with this)

curl --user enketorules: -d "server_url=https://enketo-aggregate.appspot.com&form_id=vitals&instance=<demo-vitals-grid-v4 xmlns:enk=\"http://enketo.org/xforms\" xmlns:jr=\"http://openrosa.org/javarosa\" xmlns:oc=\"http://openclinica.org/xforms\" xmlns:orx=\"http://openrosa.org/xforms\" id=\"vitals\" version=\"4\"><page1><ins_note/><rndm>5</rndm><cohort>E</cohort><cohort_note/><temp_yn/><temp_group><temp/><temp_units/><temp_unit_des/><temp_entry/><temp_entry_hidden/><temp_comment oc:queryParent=\"temp\"/><temp_units_comment oc:queryParent=\"temp_units\"/><temp_entry_comment oc:queryParent=\"temp_entry\"/><temp_entry_hidden_comment oc:queryParent=\"temp_entry_hidden\"/></temp_group><wh_y/><wh_units/><weight/><weight_unit_des>weight not entered</weight_unit_des><height/><height_unit_des>height not entered</height_unit_des><calc_note/><bmi/><bmi_hidden/><bmi_calc>0</bmi_calc><bmi_ro/><bmi_rad/><resp_rate/><pulse/><temp_yn_comment oc:queryParent=\"temp_yn\"/><wh_y_comment oc:queryParent=\"wh_y\"/><wh_units_comment oc:queryParent=\"wh_units\"/><weight_comment oc:queryParent=\"weight\"/><height_comment oc:queryParent=\"height\"/><bmi_comment oc:queryParent=\"bmi\"/><bmi_hidden_comment oc:queryParent=\"bmi_hidden\"/><bmi_rad_comment oc:queryParent=\"bmi_rad\"/><resp_rate_comment oc:queryParent=\"resp_rate\"/><pulse_comment oc:queryParent=\"pulse\"/></page1><page2><bp_yn/><bp_note/><bp_rg_count></bp_rg_count><bp_rg enk:last-used-ordinal=\"3\" enk:ordinal=\"1\"><bp_rg_num_init/><bp_rg_num/><bp_row/><bp_pos/><bp_sys/><bp_sys_val/><bp_sys_count/><bp_dia/><bp_dia_val/><bp_dia_count/><bp_ratio/><bp_ratio_hidden/><bp_dt_prec/><bp_dt_ymd/><bp_dt_ym/><bp_dt_y/><date_note/><bp_row_comment oc:queryParent=\"bp_row\"/><bp_pos_comment oc:queryParent=\"bp_pos\"/><bp_sys_comment oc:queryParent=\"bp_sys\"/><bp_dia_comment oc:queryParent=\"bp_dia\"/><bp_ratio_comment oc:queryParent=\"bp_ratio\"/><bp_ratio_hidden_comment oc:queryParent=\"bp_ratio_hidden\"/><bp_dt_prec_comment oc:queryParent=\"bp_dt_prec\"/><bp_dt_ymd_comment oc:queryParent=\"bp_dt_ymd\"/><bp_dt_ym_comment oc:queryParent=\"bp_dt_ym\"/><bp_dt_y_comment oc:queryParent=\"bp_dt_y\"/></bp_rg><bp_rg enk:ordinal=\"2\"><bp_rg_num_init>1</bp_rg_num_init><bp_rg_num>1</bp_rg_num><bp_row>2</bp_row><bp_pos>Sitting</bp_pos><bp_sys/><bp_sys_val>0</bp_sys_val><bp_sys_count>0</bp_sys_count><bp_dia/><bp_dia_val>0</bp_dia_val><bp_dia_count>0</bp_dia_count><bp_ratio>0</bp_ratio><bp_ratio_hidden/><bp_dt_prec/><bp_dt_ymd/><bp_dt_ym/><bp_dt_y/><date_note/><bp_row_comment oc:queryParent=\"bp_row\"/><bp_pos_comment oc:queryParent=\"bp_pos\"/><bp_sys_comment oc:queryParent=\"bp_sys\"/><bp_dia_comment oc:queryParent=\"bp_dia\"/><bp_ratio_comment oc:queryParent=\"bp_ratio\"/><bp_ratio_hidden_comment oc:queryParent=\"bp_ratio_hidden\"/><bp_dt_prec_comment oc:queryParent=\"bp_dt_prec\"/><bp_dt_ymd_comment oc:queryParent=\"bp_dt_ymd\"/><bp_dt_ym_comment oc:queryParent=\"bp_dt_ym\"/><bp_dt_y_comment oc:queryParent=\"bp_dt_y\"/></bp_rg><bp_rg enk:ordinal=\"3\"><bp_rg_num_init>1</bp_rg_num_init><bp_rg_num>1</bp_rg_num><bp_row>3</bp_row><bp_pos>Lying</bp_pos><bp_sys/><bp_sys_val>0</bp_sys_val><bp_sys_count>0</bp_sys_count><bp_dia/><bp_dia_val>0</bp_dia_val><bp_dia_count>0</bp_dia_count><bp_ratio>0</bp_ratio><bp_ratio_hidden/><bp_dt_prec/><bp_dt_ymd/><bp_dt_ym/><bp_dt_y/><date_note/><bp_row_comment oc:queryParent=\"bp_row\"/><bp_pos_comment oc:queryParent=\"bp_pos\"/><bp_sys_comment oc:queryParent=\"bp_sys\"/><bp_dia_comment oc:queryParent=\"bp_dia\"/><bp_ratio_comment oc:queryParent=\"bp_ratio\"/><bp_ratio_hidden_comment oc:queryParent=\"bp_ratio_hidden\"/><bp_dt_prec_comment oc:queryParent=\"bp_dt_prec\"/><bp_dt_ymd_comment oc:queryParent=\"bp_dt_ymd\"/><bp_dt_ym_comment oc:queryParent=\"bp_dt_ym\"/><bp_dt_y_comment oc:queryParent=\"bp_dt_y\"/></bp_rg><bp_sys_mean/><bp_dia_mean/><bp_number/><bp_ratio_lookup/><likert_group><likert_note/><systolic_agreement/><diastolic_agreement/><systolic_agreement_comment oc:queryParent=\"systolic_agreement\"/><diastolic_agreement_comment oc:queryParent=\"diastolic_agreement\"/></likert_group><newselectitem/><newdecimal/><pain_level/><vas_question/><media_yn/><pic/><ecg_picture/><cascade1/><cascade2/><cascade3/><us_map/><image_map_note/><add_notes/><bp_yn_comment oc:queryParent=\"bp_yn\"/><bp_sys_mean_comment oc:queryParent=\"bp_sys_mean\"/><bp_dia_mean_comment oc:queryParent=\"bp_dia_mean\"/><bp_number_comment oc:queryParent=\"bp_number\"/><bp_ratio_lookup_comment oc:queryParent=\"bp_ratio_lookup\"/><newselectitem_comment oc:queryParent=\"newselectitem\"/><newdecimal_comment oc:queryParent=\"newdecimal\"/><pain_level_comment oc:queryParent=\"pain_level\"/><vas_question_comment oc:queryParent=\"vas_question\"/><media_yn_comment oc:queryParent=\"media_yn\"/><pic_comment oc:queryParent=\"pic\"/><ecg_picture_comment oc:queryParent=\"ecg_picture\"/><cascade1_comment oc:queryParent=\"cascade1\"/><cascade2_comment oc:queryParent=\"cascade2\"/><cascade3_comment oc:queryParent=\"cascade3\"/><us_map_comment oc:queryParent=\"us_map\"/><add_notes_comment oc:queryParent=\"add_notes\"/></page2><meta><instanceID>uuid:f9456003-e436-4751-b786-91c3608c347f</instanceID><instanceID_comment oc:queryParent=\"instanceID\"/></meta></demo-vitals-grid-v4>&instance_id=a" http://localhost:8005/api/v2/instance/fieldsubmission/iframe
enketo-issue-mover commented 6 years ago

From @MartijnR on November 23, 2017 20:47

This issue is likely with how the XML record is constructed from the database on the OC side before it is sent to Enketo's API to be loaded. If this only happens for forms with a "repeat count", it is likely that the "repeat count" node is not populated when the XML record is assembled. This is probably where it should be fixed.

An alternative (just to be complete, but you can probably ignore this):

Note that the fact that a repeat count in pyxform is always a calculation can also be seen as a cause. In this case calculate="'3'" which is actually very silly. So if this issue is only with repeat counts, another solution could be to manipulate the XForm itself and let '3' just be the default value in the model of the XForm instead of a calculation. However, this is likely more complex to do and doesn't resolve the underlying issue that the instance is not complete when offered to Enketo for editing.

enketo-issue-mover commented 6 years ago

From @MartijnR on November 28, 2017 20:34

link with #789 perhaps?