1-by-1 functional comparison of XLSForms

Hi all,

At Swiss TPH, we developed a small Python tool to compare XLS forms one-by-one, tested on different versions of the WHO ODK verbal autopsy XLS forms.

:magnifying_glass_tilted_left: What it mostly does/is expected to do:

  • Assumes each variable has a unique, unchanged name (including survey notes).

  • Compares survey elements: label, relevance, calculation, required, constraint, constraint messages, and group modifications.

  • Compares choices: list name additions/removals, choice additions/removals, and label changes.

  • Detects additions or removals of survey elements.

  • Outputs an Excel file summarizing the comparison (see screenshot below).

It could be connected to the ODK Central API (retrieving form XLS) to compare deployed versions directly.

:light_bulb:What’s not there yet: comparing question order: useful, but tricky!

We (@aurdipas and I) would be happy to hear your feedback on how useful (or not!) this might be for your own form comparisons.

Disclaimer: the code could be significantly cleaner.

import os
import FormComparator as comp

root = "inputs"  # or any path to your XLSForms

f2016_xlsx = os.path.join(root, "WHOVA2016_v1_5_3_XLS_form_for_ODK.xlsx")
f2022_xlsx = os.path.join(root, "WHOVA2022_XLS_form_for_ODK.xlsx")

comparison = comp.FormComparator(cur_xlsx = f2022_xlsx,
                                 ref_xlsx = f2016_xlsx,
                                 output_dir = "outputs")

5 Likes