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

Windows error #250

Merged
merged 5 commits into from
Jul 24, 2024
Merged

Windows error #250

merged 5 commits into from
Jul 24, 2024

Conversation

yusufuyanik1
Copy link
Collaborator

  • Added warnings about Pandoc and pdstools version to Health Check app.
  • Seperated generateReport function to generate_health_check and generate_model_reports
  • Changed the temp_dir logic. Everything is written to a freshly created temp_dir and the whole folder is removed if we are not in debug mode.

python/pdstools/adm/ADMDatamart.py Fixed Show fixed Hide fixed
python/pdstools/adm/ADMDatamart.py Fixed Show fixed Hide fixed
python/pdstools/adm/ADMDatamart.py Fixed Show fixed Hide fixed
python/pdstools/adm/ADMDatamart.py Fixed Show fixed Hide fixed
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 16.09195% with 146 lines in your changes missing coverage. Please review.

Project coverage is 59.30%. Comparing base (61ea514) to head (84a26b0).

Files Patch % Lines
python/pdstools/adm/ADMDatamart.py 11.47% 108 Missing ⚠️
python/pdstools/utils/cdh_utils.py 31.70% 28 Missing ⚠️
python/pdstools/utils/streamlit_utils.py 0.00% 9 Missing ⚠️
python/pdstools/plots/plot_base.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #250      +/-   ##
==========================================
- Coverage   59.75%   59.30%   -0.45%     
==========================================
  Files          29       29              
  Lines        3809     3863      +54     
==========================================
+ Hits         2276     2291      +15     
- Misses       1533     1572      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@StijnKas StijnKas left a comment

Choose a reason for hiding this comment

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

Some small comments, but thanks for this @yusufuyanik1, looks great overall!



current_version = pdstools.__version__
latest_version = get_latest_pdstools_version()
Copy link
Collaborator

Choose a reason for hiding this comment

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

You probably want to cache this function?

self,
name: Optional[str] = None,
working_dir: Path = Path("."),
model_list: List[str] = [],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Initializing lists in the signature is typically a bad idea, I would initialize with None and generate an empty list in the function itself

delete_temp_files: bool = True,
output_type: str = "html",
allow_collect: bool = True,
cached_data: bool = False,
predictordetails_activeonly: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we should make this argument something like predictor_details_active_only? also modelid should be model_id I think?

The working directory for the output. If None, uses current working directory.
output_type : str, default='html'
The type of the output file (e.g., "html", "pdf").
debug_mode : bool, optional
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug mode doesn't sound like the proper argument name for this description, wouldn't it be something like delete_temp_dir? debug mode sounds like you'd be logging more information while running

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We already have the verbose argument for logging

  1. Use verbose for both logging and keeping temp_dir
  2. Create a new argument, debug_mode which overwrites verbose
    debug_mode = kwargs.get("debug_mode", self.verbose)
    So when it is set to True, it keeps logs and doesn't delete temp_dir

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the notes @StijnKas, now all your notes are addressed except this. Do you think this is fine or should we separate the verbose and delete temp_dir logic?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Logically I don't think they're the same thing but I follow your logic and I think it's fine to make it easier on the user. Let's stick with this.

name = name.replace(" ", "_") if name else None
if report_type == "ModelReport":
if not modelid:
raise ValueError("ModelID is required for a ModelReport.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note the difference in capitalisation here: I would recommend making the argument name model_id everywhere, and then having model_id being the 'required' property in your value error as well

sample_without_predictorbinning.generateReport(
name="MyOrg", modelid="bd70a915-697a-5d43-ab2c-53b0557c85a0"
sample_without_predictorbinning.generate_model_reports(
name="MyOrg", modelid=["bd70a915-697a-5d43-ab2c-53b0557c85a0"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

argument modelid taking a list of values doesn't make intuitive sense - is that right?

@StijnKas
Copy link
Collaborator

Resolves #213

import streamlit as st

import pdstools
from pdstools.utils.streamlit_utils import get_latest_pdstools_version
Copy link
Collaborator

Choose a reason for hiding this comment

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

Last remark: I don't think this should be in streamlit_utils, it's not streamlit specific

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I see, you want it to be cached. Maybe it could be better to use some other caching mechanism so it's streamlit agnostic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, I used streamlit's caching decorator, will try to use another way of caching

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Carried the original function to cdh_utils and calling this from streamlit_utils now.

@st.cache_data
def st_get_latest_pdstools_version():
    return cdh_utils.get_latest_pdstools_version()

@yusufuyanik1 yusufuyanik1 merged commit 2d5667e into master Jul 24, 2024
14 of 16 checks passed
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