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

feature request: access "study prefix" in python #3

Open
comorbidity opened this issue Jun 26, 2023 · 2 comments
Open

feature request: access "study prefix" in python #3

comorbidity opened this issue Jun 26, 2023 · 2 comments

Comments

@comorbidity
Copy link

pyproject.toml contains a pointer of which files to include
this is implicitly the "study prefix"

would be nice to say "from my_study_name import study_prefix" or equivlant

priority: low feature request

comorbidity added a commit to smart-on-fhir/cumulus-library-hypertension that referenced this issue Jun 26, 2023
@dogversioning
Copy link
Contributor

dogversioning commented Jun 27, 2023

so with the toml package (which we are installing with the core library), you can get to this as follows:

import toml
data = toml.load('./path/to/manifest.toml')
print(data['study_prefix'])

We can look into building this into templates/helper functions as we harden them for inclusion in the core library, but I think if you're writing custom generators inside of study directories, we're not being implicit about the way users are doing that, so it's a little bit trickier - it would more likely look something like from cumulus_library.helpers import get_study_prefix or something like this.

If you're ok with this, I'd like to close this issue here and move it to the core library.

(we could, alternatively, maintain a file in this template to accomplish the same thing, but I think putting it in core would be less of a maintenance headache here).

@comorbidity
Copy link
Author

Yes @dogversioning thats perfect
from cumulus_library.helpers import get_study_prefix

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

No branches or pull requests

2 participants