Building App Forms

Building CHT app forms

App forms allow users to submit reports from Android devices.

This tutorial will take you through how to build App forms for CHT applications, including:

  • Authoring forms in Excel, Google sheets or other spreadsheet applications.
  • Converting XLSForms to XForms
  • Uploading XForms to CHT

You will be building assessment workflow that allows Community Health Workers to conduct a health assessment for children under the age of 5.

Brief Overview of Key Concepts

App forms serve as actions within the app.

XLSForm is a form standard created to help simplify the authoring of forms in Excel.

XForm is a CHT-enhanced version of the ODK XForm standard.

Required Resources

You should have a functioning CHT instance with cht-conf installed locally and a project folder set up already.

Implementation Steps

Create a new spread sheet in Google Sheets or other preferred editor like Excel or LibreOffice. Name the spreadsheet assessment. The final file name should be assessment.xlsx.

Create 2 additional sheets. Rename the sheets survey, choices and settings.

1. Define XLS Survey/Form Fields

This rows are populated automatically before the form is rendered to the user. These fields are usually hidden by default but can be accessed to display certain information about the person being assessed.

Copy everything inside the table below by clicking the “📋 Copy survey sheet” button, then paste into cell A1 of a new sheet named survey in Google Sheets or your prefered editor:


Copied!
typenamelabelrequiredrelevantappearanceconstraintconstraint_messagecalculationchoice_filterhintdefault
begin groupinputsPatient./source = 'user'field-list
hiddensourceSourceuser
hiddensource_idSource_ID
hiddentask_idTask_ID
begin groupcontactContact
string_idPatient IDselect-contact type-personSelect a person from the list
hiddenpatient_idMedic ID
hiddennamePatient Name
begin groupparentParent
hidden_idFamily UUID
begin groupparentGrandparent
hidden_idCHW Area UUID
hiddennameCHW Name
hiddenphoneCHW Phone
begin groupparentGreat Grandparent
hidden_idCU UUID
end group
end group
end group
end group
end group
calculatepatient_id../inputs/contact/_id
calculatepatient_name../inputs/contact/name
begin groupgroup_assessmentAssessment
select_one yes_nocoughDoes ${patient_name} have a cough?yes
select_one symptom_durationcough_durationHow long has the cough lasted?yes${cough} = 'yes'
select_one yes_nofeverDoes ${patient_name} have a fever?yes
select_one yes_nodiarrheaDoes ${patient_name} have diarrhea?yes
end group
end group

2. Define the Choices

Copy everything inside the table below by clicking the “📋 Copy choices sheet” button, then paste into cell A1 of a new sheet named choices in Google Sheets or your prefered editor:


Copied!
list_namenamelabel
yes_noyesYes
yes_nonoNo
symptom_duration33 days or less
symptom_duration74 - 7 days
symptom_duration138 - 13 days
symptom_duration1414 days or more

3. Define the XLS Settings

Copy everything inside the table below by clicking the “📋 Copy settings sheet” button, then paste into cell A1 of a new sheet named settings in Google Sheets or your prefered editor:


Copied!
form_titleform_idversionstylepathinstance_namedefault_language
Assess patientassessment1pagesdataen

4. Convert the XLSForm and Upload the XForm

Add the file to the forms/app subfolder in your project.

project-name
  forms
    app
      assessment.xlsx

To convert and upload the form to your local instance, run the following command from the root folder:

cht --url=https://<username>:<password>@localhost --accept-self-signed-certs convert-app-forms upload-app-forms -- assessment

Important

Be sure to replace the values <username> and <password> with the actual username and password of your test instance.

Next steps


Build > Forms > contact

Contact Forms: Used to create and edit people and places

Build > Forms > app

App Forms: Used to complete reports, tasks, and actions in the app

Design > Best Practices : Forms

Best practices for configuring CHT Applications

Design > Best Practices : Content and Layout

Best practices for configuring CHT Applications

Design > Best Practices : Summary Page

Best practices for configuring CHT Applications

Last updated on

Did this documentation help you ?