Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MLS support to native forms #367

Closed
4 tasks done
vincent-karuri opened this issue Feb 20, 2020 · 10 comments · Fixed by #373
Closed
4 tasks done

Add MLS support to native forms #367

vincent-karuri opened this issue Feb 20, 2020 · 10 comments · Fixed by #373
Assignees

Comments

@vincent-karuri
Copy link
Contributor

vincent-karuri commented Feb 20, 2020

  • Create util that processes interpolated strings in a json form file, respecting locale settings
  • Translate json form on form launch (make this optional for backward compatibility)
  • Related to above, formulate convention for naming form string property files
  • Translate strings in rules engine yaml files
@vincent-karuri
Copy link
Contributor Author

@cafootitt @dubdabasoduba I'll need your help creating an interpolated json form and separate property files for each translation needed.

Also, the expected json forms after translation.

@vincent-karuri
Copy link
Contributor Author

{
  "count": "1",
  "encounter_type": "patient_registration",
  "entity_id": "",
  "metadata": {
    "start": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "start",
      "openmrs_entity_id": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "end": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "end",
      "openmrs_entity_id": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "today": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "encounter",
      "openmrs_entity_id": "encounter_date"
    },
    "deviceid": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "deviceid",
      "openmrs_entity_id": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "subscriberid": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "subscriberid",
      "openmrs_entity_id": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "simserial": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "simserial",
      "openmrs_entity_id": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "phonenumber": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "phonenumber",
      "openmrs_entity_id": "163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "encounter_location": ""
  },
  "step1": {
    "title": "{{step1.title}}",
    "display_back_button": "true",
    "previous_label": "{{step1.previous_label}}",
    "bottom_navigation": "true",
    "bottom_navigation_orientation": "vertical",
    "next_type": "submit",
    "submit_label": "{{step1.submit_label}}",
    "next_form": "json.form/patient-registration-form.json",
    "fields": [
      {
        "key": "patient_name_label",
        "type": "label",
        "text": "{{step1.patient_name_label.text}}",
        "text_color": "#000000"
      },
      {
        "key": "patient_name",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person",
        "openmrs_entity_id": "first_name",
        "type": "edit_text",
        "edit_type": "name"
      },
      {
        "key": "patient_id_label",
        "type": "label",
        "text": "Patient ID",
        "text_color": "#000000"
      },
      {
        "key": "patient_id",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "edit_text",
        "v_required": {
          "value": "true",
          "err": "Please enter patient ID"
        }
      },
      {
        "key": "sex",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person",
        "openmrs_entity_id": "gender",
        "type": "native_radio",
        "label": "{{step1.sex.label}}",
        "options": [
          {
            "key": "Female",
            "text": "{{step1.sex.options.Female.text}}"
          },
          {
            "key": "Male",
            "text": "{{step1.sex.options.Male.text}}"
          }
        ],
        "v_required": {
          "value": "true",
          "err": "{{step1.sex.v_required.err}}"
        }
      },
      {
        "key": "patient_dob",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person_attribute",
        "openmrs_entity_id": "birthdate",
        "type": "date_picker",
        "hint": "{{step1.patient_dob.hint}}",
        "expanded": false,
        "duration": {
          "label": "{{step1.patient_dob.duration.label}}"
        },
        "min_date": "today-100y",
        "max_date": "today"
      },
      {
        "key": "age",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "hidden",
        "value": ""
      },
      {
        "key": "patient_occupation_label",
        "type": "label",
        "text": "{{step1.patient_occupation_label.text}}",
        "text_color": "#000000"
      },
      {
        "key": "patient_occupation",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "edit_text",
        "v_required": {
          "value": "false",
          "err": ""
        }
      },
      {
        "key": "been_treated",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "native_radio",
        "label": "{{step1.been_treated.label}}",
        "options": [
          {
            "key": "Yes",
            "text": "{{step1.been_treated.options.Yes.text}}"
          },
          {
            "key": "No",
            "text": "{{step1.been_treated.options.No.text}}"
          },
          {
            "key": "Not Answered",
            "text": "{{step1.been_treated.options.not_answered.text}}"
          }
        ],
        "v_required": {
          "value": "true",
          "err": "{{step1.been_treated.v_required.err}}"
        }
      }
    ]
  }
}

This is the format of an interpolated json form

@vincent-karuri
Copy link
Contributor Author

{
  "count": "1",
  "encounter_type": "patient_registration",
  "entity_id": "",
  "metadata": {
    "start": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "start",
      "openmrs_entity_id": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "end": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "end",
      "openmrs_entity_id": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "today": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "encounter",
      "openmrs_entity_id": "encounter_date"
    },
    "deviceid": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "deviceid",
      "openmrs_entity_id": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "subscriberid": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "subscriberid",
      "openmrs_entity_id": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "simserial": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "simserial",
      "openmrs_entity_id": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "phonenumber": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "phonenumber",
      "openmrs_entity_id": "163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "encounter_location": ""
  },
  "step1": {
    "title": "New client record",
    "display_back_button": "true",
    "previous_label": "SAVE AND EXIT",
    "bottom_navigation": "true",
    "bottom_navigation_orientation": "vertical",
    "next_type": "submit",
    "submit_label": "SAVE",
    "next_form": "json.form/patient-registration-form.json",
    "fields": [
      {
        "key": "patient_name_label",
        "type": "label",
        "text": "Name",
        "text_color": "#000000"
      },
      {
        "key": "patient_name",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person",
        "openmrs_entity_id": "first_name",
        "type": "edit_text",
        "edit_type": "name"
      },
      {
        "key": "patient_id_label",
        "type": "label",
        "text": "Patient ID",
        "text_color": "#000000"
      },
      {
        "key": "patient_id",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "edit_text",
        "v_required": {
          "value": "true",
          "err": "Please enter patient ID"
        }
      },
      {
        "key": "sex",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person",
        "openmrs_entity_id": "gender",
        "type": "native_radio",
        "label": "Gender",
        "options": [
          {
            "key": "Female",
            "text": "Female"
          },
          {
            "key": "Male",
            "text": "Male"
          }
        ],
        "v_required": {
          "value": "true",
          "err": "Please specify gender"
        }
      },
      {
        "key": "patient_dob",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person_attribute",
        "openmrs_entity_id": "birthdate",
        "type": "date_picker",
        "hint": "Patient's date of birth",
        "expanded": false,
        "duration": {
          "label": "Age"
        },
        "min_date": "today-100y",
        "max_date": "today"
      },
      {
        "key": "age",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "hidden",
        "value": ""
      },
      {
        "key": "patient_occupation_label",
        "type": "label",
        "text": "Occupation",
        "text_color": "#000000"
      },
      {
        "key": "patient_occupation",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "edit_text",
        "v_required": {
          "value": "false",
          "err": ""
        }
      },
      {
        "key": "been_treated",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "native_radio",
        "label": "Has been treated for malaria in the past 3 months?",
        "options": [
          {
            "key": "Yes",
            "text": "Yes"
          },
          {
            "key": "No",
            "text": "No"
          },
          {
            "key": "Not Answered",
            "text": "Not Answered"
          }
        ],
        "v_required": {
          "value": "true",
          "err": "Has the patient been treated for malaria in the past 3 months?"
        }
      }
    ]
  }
}

This is the expected output json for en_US

@vincent-karuri
Copy link
Contributor Author

{
  "count": "1",
  "encounter_type": "patient_registration",
  "entity_id": "",
  "metadata": {
    "start": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "start",
      "openmrs_entity_id": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "end": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "end",
      "openmrs_entity_id": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "today": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "encounter",
      "openmrs_entity_id": "encounter_date"
    },
    "deviceid": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "deviceid",
      "openmrs_entity_id": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "subscriberid": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "subscriberid",
      "openmrs_entity_id": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "simserial": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "simserial",
      "openmrs_entity_id": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "phonenumber": {
      "openmrs_entity_parent": "",
      "openmrs_entity": "concept",
      "openmrs_data_type": "phonenumber",
      "openmrs_entity_id": "163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "encounter_location": ""
  },
  "step1": {
    "title": "Data Pasien Baru",
    "display_back_button": "true",
    "previous_label": "SIMPAN DAN KELUAR",
    "bottom_navigation": "true",
    "bottom_navigation_orientation": "vertical",
    "next_type": "submit",
    "submit_label": "SIMPAN",
    "next_form": "json.form/patient-registration-form.json",
    "fields": [
      {
        "key": "patient_name_label",
        "type": "label",
        "text": "Nama",
        "text_color": "#000000"
      },
      {
        "key": "patient_name",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person",
        "openmrs_entity_id": "first_name",
        "type": "edit_text",
        "edit_type": "name"
      },
      {
        "key": "patient_id_label",
        "type": "label",
        "text": "Patient ID",
        "text_color": "#000000"
      },
      {
        "key": "patient_id",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "edit_text",
        "v_required": {
          "value": "true",
          "err": "Please enter patient ID"
        }
      },
      {
        "key": "sex",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person",
        "openmrs_entity_id": "gender",
        "type": "native_radio",
        "label": "Jenis kelamin pasien",
        "options": [
          {
            "key": "Female",
            "text": "Perempuan"
          },
          {
            "key": "Male",
            "text": "Laki-laki"
          }
        ],
        "v_required": {
          "value": "true",
          "err": "Silakan sebutkan jenis kelamin"
        }
      },
      {
        "key": "patient_dob",
        "openmrs_entity_parent": "",
        "openmrs_entity": "person_attribute",
        "openmrs_entity_id": "birthdate",
        "type": "date_picker",
        "hint": "Tanggal lahir pasien",
        "expanded": false,
        "duration": {
          "label": "Usia"
        },
        "min_date": "today-100y",
        "max_date": "today"
      },
      {
        "key": "age",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "hidden",
        "value": ""
      },
      {
        "key": "patient_occupation_label",
        "type": "label",
        "text": "Pekerjaan pasien",
        "text_color": "#000000"
      },
      {
        "key": "patient_occupation",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "edit_text",
        "v_required": {
          "value": "false",
          "err": ""
        }
      },
      {
        "key": "been_treated",
        "openmrs_entity_parent": "",
        "openmrs_entity": "",
        "openmrs_entity_id": "",
        "type": "native_radio",
        "label": "Pernah dirawat karena Malaria dalam 3 bulan terakhir?",
        "options": [
          {
            "key": "Yes",
            "text": "Ya"
          },
          {
            "key": "No",
            "text": "Tidak"
          },
          {
            "key": "Not Answered",
            "text": "Tidak dijawab"
          }
        ],
        "v_required": {
          "value": "true",
          "err": "Pernahkah pasien dirawat karena malaria dalam 3 bulan terakhir?"
        }
      }
    ]
  }
}

This is the expected json for id (Bahasa)

@vincent-karuri
Copy link
Contributor Author

step1.title = "New client record"
step1.previous_label = "SAVE AND EXIT"
step1.submit_label = "SAVE"
step1.patient_name_label.text = "Name"
step1.sex.label = "Gender"
step1.sex.options.Female.text = "Female"
step1.sex.options.Male.text = "Male"
step1.sex.v_required.err = "Please specify gender"
step1.patient_dob.hint = "Patient's date of birth"
step1.patient_dob.duration.label = "Age"
step1.patient_occupation_label.text = "Occupation"
step1.been_treated.label = "Has been treated for malaria in the past 3 months?"
step1.been_treated.options.Yes.text = "Yes"
step1.been_treated.options.No.text = "No"
step1.been_treated.options.not_answered.text = "Not Answered"
step1.been_treated.v_required.err = "Has the patient been treated for malaria in the past 3 months?"

This is the en_US property file

@vincent-karuri
Copy link
Contributor Author

step1.title = "Data Pasien Baru"
step1.previous_label = "SIMPAN DAN KELUAR"
step1.submit_label = "SIMPAN"
step1.patient_name_label.text = "Nama"
step1.sex.label = "Jenis kelamin pasien"
step1.sex.options.Female.text = "Perempuan"
step1.sex.options.Male.text = "Laki-laki"
step1.sex.v_required.err = "Silakan sebutkan jenis kelamin"
step1.patient_dob.hint = "Tanggal lahir pasien"
step1.patient_dob.duration.label = "Usia"
step1.patient_occupation_label.text = "Pekerjaan pasien"
step1.been_treated.label = "Pernah dirawat karena Malaria dalam 3 bulan terakhir?"
step1.been_treated.options.Yes.text = "Ya"
step1.been_treated.options.No.text = "Tidak"
step1.been_treated.options.not_answered.text = "Tidak dijawab"
step1.been_treated.v_required.err = "Pernahkah pasien dirawat karena malaria dalam 3 bulan terakhir?"

This is the id (Bahasa) property file.

@vincent-karuri
Copy link
Contributor Author

For any anc forms to be interpreted, this would be the files required and in this format.

@cafootitt
Copy link

I don't know what to do or provide here. @dubdabasoduba if something is needed from me here, please set up a short mtg so I can understand the ask here.

@dubdabasoduba
Copy link
Member

@vincent-karuri Will the Registration form be enough for the MVP or you would like an additional form?

@vincent-karuri
Copy link
Contributor Author

@dubdabasoduba That would be enough.

@cafootitt yours would probably be providing the translations (property files), but maybe @dubdabasoduba can do that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants