Skip to content

Conversation

@michelle-a-bryson
Copy link

@michelle-a-bryson michelle-a-bryson commented May 3, 2025

Description

Add to demo of response options similarity in Jupyter walkthrough. With this change, the response options are displayed under each question. I have yet to save this change to Colab as I am running into the issue in #99.

Fixes #103

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Testing

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Since the Harmony Python package is used by the Harmony API (which is itself used by the R library and the web app), we need to avoid making any changes that break the Harmony API. Please also run the Harmony API unit tests and check that the API still runs with your changes to the Python package: https://github.com/harmonydata/harmonyapi

Test Configuration

  • Library version:
  • OS:
  • Toolchain:

Checklist

  • My PR is for one issue, rather than for multiple unrelated fixes.
  • My code follows the style guidelines of this project. I have applied a Linter (recommended: Pycharm's code formatter) to make my whitespace consistent with the rest of the project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • The Harmony API is not broken by my change to the Harmony Python library
  • I add third party dependencies only when necessary. If I changed the requirements, it changes in requirements.txt, pyproject.toml and also in the requirements.txt in the API repo
  • If I introduced a new feature, I documented it (e.g. making a script example in the script examples repository so that people will know how to use it.

@michelle-a-bryson
Copy link
Author

I had also added a plot of the response options similarity matrix, as shown below, but for this specific example but it did not seem to add value because of the low variation due to some questions not having response options, so I did not include the plot.

options_matrix

@michelle-a-bryson
Copy link
Author

I could perhaps modify create_instrument_from_list to have an optional parameter that allows you to specify response options as well? Then I could add response options to the Norwegian GAD-7 instrument in the demonstration which would yield a more interesting matrix.

@michelle-a-bryson michelle-a-bryson changed the title #103: Improve demo of "harmonisation of response options" to Jupyter walkthrough #103: Improve demo of "harmonisation of response options" in Jupyter walkthrough May 3, 2025
@michelle-a-bryson
Copy link
Author

This is the result if I change the examples used to GHQ 12 English and GAD-7 Portuguese which differ more in their response options:

matrix

@jaydugad
Copy link
Collaborator

jaydugad commented May 6, 2025

Hey @michelle-a-bryson, thanks for the PR!

The test test_single_instrument_with_options is currently failing with the following error:

TypeError: create_instrument_from_list() got an unexpected keyword argument 'options_map'

Could you please update the create_instrument_from_list() function to accept an options_map=None parameter and handle it accordingly inside the function?

That should resolve the failing test. Let me know if you need any help — thanks again!

@michelle-a-bryson
Copy link
Author

Could you please update the create_instrument_from_list() function to accept an options_map=None parameter and handle it accordingly inside the function?

@jaydugad hm we do have that change already here... I wonder if the test file is not importing the updated function as expected?

@woodthom2
Copy link
Contributor

Thanks so much Michelle - I have been checking this PR but I can't currently merge it because I am not entirely sure why we have the parameter options_map. The create_instrument_from_list function already has the argument answer_texts which is a list of the same length of the list of questions, so it looks like options_map is duplicating that logic?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add demo of "harmonisation of response options" to Jupyter/Colab walkthrough

4 participants