Post code-cleanup

This commit is contained in:
lwark
2025-01-21 15:18:37 -06:00
parent bf711369c6
commit bc4af61f5f
26 changed files with 546 additions and 377 deletions

View File

@@ -7,7 +7,6 @@ from PyQt6.QtWidgets import QWidget
import plotly, logging
from plotly.graph_objects import Figure
import pandas as pd
from frontend.widgets.functions import select_save_file
from tools import divide_chunks
logger = logging.getLogger(f"submissions.{__name__}")
@@ -65,7 +64,8 @@ class CustomFigure(Figure):
)
assert isinstance(self, CustomFigure)
def make_plotly_buttons(self, months: int = 6) -> Generator[dict, None, None]:
@classmethod
def make_plotly_buttons(cls, months: int = 6) -> Generator[dict, None, None]:
"""
Creates html buttons to zoom in on date areas
@@ -115,7 +115,8 @@ class CustomFigure(Figure):
{"yaxis.title.text": mode},
])
def to_html(self) -> str:
@property
def html(self) -> str:
"""
Creates final html code from plotly

View File

@@ -19,10 +19,10 @@ class IridaFigure(CustomFigure):
super().__init__(df=df, modes=modes, settings=settings)
self.df = df
try:
months = int(settings['months'])
except KeyError:
months = 6
# try:
# months = int(settings['months'])
# except KeyError:
# months = 6
self.construct_chart(df=df, modes=modes, start_date=settings['start_date'], end_date=settings['end_date'])

View File

@@ -17,10 +17,10 @@ class PCRFigure(CustomFigure):
months: int = 6):
super().__init__(df=df, modes=modes, settings=settings)
self.df = df
try:
months = int(settings['months'])
except KeyError:
months = 6
# try:
# months = int(settings['months'])
# except KeyError:
# months = 6
self.construct_chart(df=df)
def construct_chart(self, df: pd.DataFrame):

View File

@@ -19,10 +19,10 @@ class TurnaroundChart(CustomFigure):
months: int = 6):
super().__init__(df=df, modes=modes, settings=settings)
self.df = df
try:
months = int(settings['months'])
except KeyError:
months = 6
# try:
# months = int(settings['months'])
# except KeyError:
# months = 6
self.construct_chart()
if threshold:
self.add_hline(y=threshold)