-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
The eQ schema has changed to require a response_id field. The current payload - when launching a survey from Frontstage - is missing that key.
Respondent Home currently implements a function to generate the required response_id, which is defined as:
def build_response_id(case_id, collex_id, iac):
"""
Builds a response_id from a case ID, a collection exercise ID, and an IAC
:param case_id: a case UUID
:param collex_id: a collection exercise UUID
:param iac: an IAC
:return: a base-64 encoded sha-256 hash of case_id|collex_id|iac
"""
hash_string = f'{case_id}|{collex_id}|{iac}'
m = hashlib.sha256()
m.update(hash_string.encode('utf-8'))
logger.debug("Hash created", digest=m.hexdigest(), case_id=case_id, collex_id=collex_id)
return base64.urlsafe_b64encode(m.digest()).decode()NB: this implementation imports and makes use of the stdlibs hashlib and base64.