Files
testing123/streamlit_dashboard/page_classes/page_class_constants.py
2026-05-21 08:40:24 -04:00

61 lines
3.0 KiB
Python

"""
Central dependency injection registry and configuration mapping for dashboard reports.
This module defines the `REPORT_CONFIGS` dictionary, which acts as the single source
of truth for instantiating concrete report classes. It decouples the application's page
routing and security middleware (`AuthenticationPageWrapper`) from the specific initialization
requirements of each individual report class.
By mapping class definitions directly to their required keyword arguments, the application
can dynamically construct complex pages at runtime. For example, it securely injects environment
constants and API credentials into data-heavy classes like `NaicsReportPage`, while providing
empty configuration dictionaries to self-contained classes like `NetworkNbsMilestonesReportPage`
and `NetworkFundingMilestonesReportPage` to register them as valid, instantiable routes.
Crucially, it injects this entire configuration registry into the `ComparerPage`, granting it
the necessary architectural context to dynamically instantiate and manage side-by-side versions
of any other active report in the system.
"""
from page_classes.naics_report_page_class import NaicsReportPage
from page_classes.nbs_milestones_page_class import NetworkNbsMilestonesReportPage
from page_classes.funding_milestones_page_class import NetworkFundingMilestonesReportPage
from page_classes.training_count_statistics_page_class import TrainingsCountStatisticsPage
from page_classes.training_attendee_ranges_page_class import TrainingAttendeeRanges
from page_classes.training_event_count_attendee_comparison_page_class import TrainingEventCountAttendeeComparison
from page_classes.training_primary_topics_page_class import TrainingsPrimaryTopicsPage
from page_classes.training_attendee_counts_class import TrainingEventAttendeeCounts
from page_classes.training_event_count_page_class import TrainingsEventCountsPage
from page_classes.report_comparer_page_class import ComparerPage
from page_classes.center_milestones_page_class import CenterMilestonesReportPage
from page_classes.home_page_class import HomePage
from streamlit_constants import CENSUS_YEAR, USDA_API_KEY, CURRENT_FY_NBS_EXPORT_URL, PREV_FY_NBS_EXPORT_URL, CURRENT_FY_FUNDING_EXPORT_URL, PREV_FY_FUNDING_EXPORT_URL, CURRENT_FY_TRAININGS_EXPORT_URL, PREV_FY_TRAININGS_EXPORT_URL
REPORT_CONFIGS = {
NaicsReportPage:{
},
# These reports do not need any arguments for their constructors, but we still define them as blank so that the app knows what report pages are available in the app
NetworkNbsMilestonesReportPage:{
},
NetworkFundingMilestonesReportPage: {
},
TrainingsCountStatisticsPage: {
},
TrainingAttendeeRanges: {
},
TrainingEventCountAttendeeComparison:{
},
TrainingsPrimaryTopicsPage: {
},
TrainingEventAttendeeCounts: {
},
TrainingsEventCountsPage: {
},
CenterMilestonesReportPage: {
},
HomePage: {
},
}
REPORT_CONFIGS[ComparerPage] = {
'report_configs': REPORT_CONFIGS
}