Generate a compact schema for codes, questions, and answers.
Additionally, add some parsed configuration data needed by the app.
The region and countries have different data dictionaries (configs)
since they have different variables associated with them (although they
mostly overlap). Otherwise, the schema's for config/data files are meant
to be as identical as possible so that the application code does not
have to distinguish between the two. It is anticipated that the application
will select a "geoMode" (region or country), and then use the appropriate
config + data object to provide the list of available questions and the
corresponding results.
The data object is an array of values whose index is defined on the config
object. This allows a very compact format, but introduces some complexity
in accessing the data. As a consequence, the application will provide an
"indexer" class that can abstract the schema away and provide for a nice API
for getting the response for a given question (for a given geoMode)
Connects #3
Notes
I did not check in the data updates with this PR. I imagine the workflow to be to check in new versions of the data with corresponding updates to the application to ensure that there is always parity and the app does not break.
The version of this script uses local xlsx files, which can be found on the project GDrive, though it will ultimatley operate on data published to HDX. If they are published in time, I'll update this PR, otherwise will follow up with a fix later
We'll want a solid README that captures this, but I'm going to wait until the data is published and finalized (#14)
Testing Instructions
On the VM, run ./scripts/dataproc and ensure:
that two config and two data files are generated
they are valid JSON
the region and country data files share the same schema, though the contents differ
that the relationship between config and data files is comprehensible
Overview
Generate a compact schema for codes, questions, and answers. Additionally, add some parsed configuration data needed by the app.
The region and countries have different data dictionaries (configs) since they have different variables associated with them (although they mostly overlap). Otherwise, the schema's for config/data files are meant to be as identical as possible so that the application code does not have to distinguish between the two. It is anticipated that the application will select a "geoMode" (region or country), and then use the appropriate config + data object to provide the list of available questions and the corresponding results.
The data object is an array of values whose index is defined on the config object. This allows a very compact format, but introduces some complexity in accessing the data. As a consequence, the application will provide an "indexer" class that can abstract the schema away and provide for a nice API for getting the response for a given question (for a given
geoMode
)Connects #3
Notes
Testing Instructions
./scripts/dataproc
and ensure: