Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eQ Payload is missing required field response_id #415

Open
jcox-dev opened this issue Oct 29, 2018 · 0 comments
Open

eQ Payload is missing required field response_id #415

jcox-dev opened this issue Oct 29, 2018 · 0 comments

Comments

@jcox-dev
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant