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

Support storing nsrr_token in config or environment variable #243

Merged
merged 13 commits into from
Nov 7, 2024

Conversation

simon-p-2000
Copy link
Contributor

@simon-p-2000 simon-p-2000 commented Nov 3, 2024

Added support for storing the nsrr_token in an environment variable or the config file of sleepecg. Since the nsrr_token can be set in multiple ways, the hierarchy for which nsrr_token is used is set as such:

  1. using the nsrr_token set via the set_nsrr_token function defined in nsrr.py
  2. using the nsrr_token set in an environment variable
  3. using the nsrr_token set in the config file

Currently, sleepecg provides no functionality to set the nsrr_token as an environment variable or in the config file. Instead, these actions have to be performed by hand.

In addtion, the test_nsrr.py file was added introducing four test cases. Three cases cover the setting of the nsrr_token via methods 1-3 while the fourth test case covers an unset nsrr_token.

tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
tests/test_nsrr.py Outdated Show resolved Hide resolved
src/sleepecg/io/nsrr.py Outdated Show resolved Hide resolved
src/sleepecg/io/nsrr.py Outdated Show resolved Hide resolved
Copy link
Owner

@cbrnr cbrnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'd prefer the environment variable to be NSRR_TOKEN (all caps), since this is more customary.

Copy link
Owner

@cbrnr cbrnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you've addressed these comments, please update the corresponding section in the docs and add an entry to CHANGELOG.md.

@cbrnr
Copy link
Owner

cbrnr commented Nov 6, 2024

The config system also needs to be updated in order to recognize nsrr_token as a valid key.

Copy link
Owner

@cbrnr cbrnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few final comments and this is ready!

CHANGELOG.md Outdated Show resolved Hide resolved
docs/datasets.md Outdated Show resolved Hide resolved
docs/datasets.md Outdated Show resolved Hide resolved
docs/datasets.md Outdated Show resolved Hide resolved
src/sleepecg/io/nsrr.py Outdated Show resolved Hide resolved
@cbrnr cbrnr merged commit 6f3073a into cbrnr:main Nov 7, 2024
5 checks passed
@cbrnr
Copy link
Owner

cbrnr commented Nov 7, 2024

Thanks a lot @simon-p-2000 🎉!

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.

2 participants