Commit 19d1d958 authored by Hueser, Christian (FWCC) - 138593's avatar Hueser, Christian (FWCC) - 138593 Committed by Erxleben, Fredo
Browse files

Replace underscore by slash in IDs mentioned in CSV data header

* Underscores in IDs of CSV data header need to be replaced by a slash.
* Character used in IDs of CSV data header need to be configurable.
* Adapt README to take into account new configuration variables.
parent b9e0d350
Pipeline #103533 passed with stage
in 54 seconds
......@@ -206,6 +206,8 @@ hifis-surveyval init
This file contains the following information:
METADATA: metadata/meta.yml
......@@ -215,6 +217,13 @@ SCRIPT_FOLDER: scripts
- `ANONYMOUS_QUESTION_ID` defines a placeholder for Questions IDs. The CSV data
might not explicitly mention a full ID of a Question but solely the
QuestionCollection ID. In this case the HIFIS Surveyval Framework adds a
character to the QuestionCollection ID to mark this situation.
- There are different ways to separate the QuestionCollection ID from the
Question ID in the full ID mentioned in the header of the CSV data.
`DATA_ID_SEPARATOR` indicates which character is used to separate these IDs.
- With `ID_COLUMN_NAME` you may want to specify the name of the _id_ column in
the CSV data file.
- Each analysis needs metadata about the questions asked in the survey and
......@@ -196,6 +196,10 @@ class FileSettings(BaseSettings):
# question collection by LimeSurvey
# Separator used in header of CSV data to separate QuestionCollection ID
# and Question ID.
class Config:
Subclass for specification.
......@@ -169,6 +169,15 @@ class DataContainer(object):
potential_question_id = header[index]
# Replace separator DATA_ID_SEPARATOR by separator
# HIERARCHY_SEPARATOR before working with full Question IDs
# in order to use an unambiguous and unique character to separate
# QuestionCollection ID and Question ID.
if self._settings.DATA_ID_SEPARATOR in potential_question_id:
potential_question_id = potential_question_id.replace(
# Limesurvey has that thing where questions may be at the top
# level (i.e. not within a collection) but still named as if
# they were a collection. This is not possible in the
......@@ -180,7 +189,7 @@ class DataContainer(object):
# there won't be any naming confusion introduced here.
if Identifiable.HIERARCHY_SEPARATOR not in potential_question_id:
potential_question_id += Identifiable.HIERARCHY_SEPARATOR
potential_question_id += Settings.ANONYMOUS_QUESTION_ID
potential_question_id += self._settings.ANONYMOUS_QUESTION_ID
# Handle the regular case
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment