Skip to content

Resource file path from simulation #1410

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

Merged
merged 79 commits into from
Jun 4, 2025
Merged

Conversation

jkumwenda
Copy link
Collaborator

Created resource file path function and calling it from different modules.

@jkumwenda jkumwenda linked an issue Jul 2, 2024 that may be closed by this pull request
5 tasks
thewati and others added 20 commits July 30, 2024 15:50
…tate cancer, fixed test equipment and dxmanager
…t.py and breast_cancer.py method updated for resource file path from simulation.py
…t.py and breast_cancer.py method updated for resource file path from simulation.py
…t.py isort the import to fix incorrectly sorted error
# Conflicts:
#	src/tlo/methods/alri.py
#	src/tlo/methods/depression.py
#	src/tlo/methods/diarrhoea.py
#	src/tlo/methods/epilepsy.py
#	src/tlo/methods/rti.py
…rent activ resource file in the HIV resource folder
…s(self, resourcefilepath: Optional[Path] = None):

        parameter_dataframe = read_csv_files(resourcefilepath /
…sourcefilepath is None:

        resourcefilepath = get_root_path() / 'resources' from utils.py.
…sourcefilepath is None:

        resourcefilepath = get_root_path() / 'resources' from utils.py.
…sourcefilepath is None:

        resourcefilepath = get_root_path() / 'resources' from utils.py.
…cefilepath is None:

        resourcefilepath = get_root_path() / 'resources' from utils.py.
…cefilepath is None:

        resourcefilepath = get_root_path() / 'resources' from utils.py.
…to jkumwenda/resource_file_path

# Conflicts:
#	src/tlo/methods/scenario_switcher.py
# Conflicts:
#	src/tlo/analysis/utils.py
#	src/tlo/methods/bladder_cancer.py
#	src/tlo/methods/breast_cancer.py
#	src/tlo/methods/enhanced_lifestyle.py
#	src/tlo/methods/oesophagealcancer.py
#	src/tlo/methods/other_adult_cancers.py
#	src/tlo/methods/prostate_cancer.py
#	src/tlo/methods/stunting.py
@jkumwenda
Copy link
Collaborator Author

jkumwenda commented Jan 21, 2025

@tbhallett please review and merge in master if all is good. I have addressed all comments from @mnjowe

def __init__(
self,
*,
start_date: Date,
seed: Optional[int] = None,
log_config: Optional[dict] = None,
show_progress_bar: bool = False,
resourcefilepath: Optional[Path] = None,
resourcefilepath: Optional[str | Path] = None,
Copy link
Collaborator

@tbhallett tbhallett Jan 21, 2025

Choose a reason for hiding this comment

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

agreed about query of whether we think string is ok here -- and I wasn't sure if the whole argument should be Optional.

I see below that a string would be OK as line 112 wraps this in Path().

I also see that the comment on line 93 explains that not giving a parameter is ok.

I don't know why that would be mean, but there might be a reason.

Suggested change
resourcefilepath: Optional[str | Path] = None,
resourcefilepath: Path,

@tbhallett
Copy link
Collaborator

Great work, @jkumwenda --- so glad this is working now.

My comments will mostly be for @tamuri, I think. I am not sure myself what the right thing to do would be, so have commented where I would instinctively have done something different.

@tamuri tamuri merged commit 7062cf0 into master Jun 4, 2025
62 checks passed
@tamuri tamuri deleted the jkumwenda/resource_file_path branch June 4, 2025 09:42
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.

Get resource file path from simulation
6 participants