144 lines
5.7 KiB
Python
144 lines
5.7 KiB
Python
"""
|
|
Endobest Dashboard - Centralized Constants Module
|
|
|
|
This module defines ALL constants used across the Endobest Dashboard application.
|
|
It serves as the single source of truth for all configuration values.
|
|
|
|
All other modules MUST import constants from this module, NOT define them locally.
|
|
|
|
Structure:
|
|
- File names & paths
|
|
- Table names (Excel sheets)
|
|
- API endpoints
|
|
- Authentication credentials
|
|
- Threading & retry parameters
|
|
- Protocol IDs
|
|
- UI formatting constants
|
|
"""
|
|
|
|
# ============================================================================
|
|
# FILE NAMES & PATHS
|
|
# ============================================================================
|
|
|
|
INCLUSIONS_FILE_NAME = "endobest_inclusions.json"
|
|
ORGANIZATIONS_FILE_NAME = "endobest_organizations.json"
|
|
OLD_FILE_SUFFIX = "_old"
|
|
CONFIG_FOLDER_NAME = "config"
|
|
|
|
# ============================================================================
|
|
# EXCEL CONFIGURATION FILES
|
|
# ============================================================================
|
|
|
|
DASHBOARD_CONFIG_FILE_NAME = "Endobest_Dashboard_Config.xlsx"
|
|
ORG_CENTER_MAPPING_FILE_NAME = "eb_org_center_mapping.xlsx"
|
|
|
|
# ============================================================================
|
|
# TABLE NAMES (Excel sheets in DASHBOARD_CONFIG_FILE_NAME)
|
|
# ============================================================================
|
|
|
|
INCLUSIONS_MAPPING_TABLE_NAME = "Inclusions_Mapping"
|
|
ORGANIZATIONS_MAPPING_TABLE_NAME = "Organizations_Mapping"
|
|
EXCEL_WORKBOOKS_TABLE_NAME = "Excel_Workbooks"
|
|
EXCEL_SHEETS_TABLE_NAME = "Excel_Sheets"
|
|
REGRESSION_CHECK_TABLE_NAME = "Regression_Check"
|
|
ORG_CENTER_MAPPING_TABLE_NAME = "Org_Center_Mapping"
|
|
|
|
# ============================================================================
|
|
# API ENDPOINTS & AUTHENTICATION
|
|
# ============================================================================
|
|
|
|
IAM_URL = "https://api-auth.ziwig-connect.com"
|
|
RC_URL = "https://api-hcp.ziwig-connect.com"
|
|
GDD_URL = "https://api-lab.ziwig-connect.com"
|
|
RC_APP_ID = "602aea51-cdb2-4f73-ac99-fd84050dc393"
|
|
|
|
DEFAULT_USER_NAME = "ziwig-invest2@yopmail.com"
|
|
DEFAULT_PASSWORD = "pbrrA765$bP3beiuyuiyhiuy!agxagx"
|
|
|
|
# ============================================================================
|
|
# RESEARCH PROTOCOL CONFIGURATION
|
|
# ============================================================================
|
|
|
|
RC_ENDOBEST_PROTOCOL_ID = "3c7bcb4d-91ed-4e9f-b93f-99d8447a276e"
|
|
RC_ENDOBEST_EXCLUDED_CENTERS = [
|
|
"e18e7487-60d5-4110-b465-b4156fe0e7f3",
|
|
"5582bd75-12fd-4d8e-bfd6-d63c43667a99",
|
|
"e053512f-d989-4564-8a73-b3d2d1b38fec"
|
|
]
|
|
|
|
# ============================================================================
|
|
# API ENDPOINTS
|
|
# ============================================================================
|
|
|
|
# Authentication endpoints
|
|
API_AUTH_LOGIN_ENDPOINT = "/api/auth/ziwig-pro/login"
|
|
API_AUTH_CONFIG_TOKEN_ENDPOINT = "/api/auth/config-token"
|
|
API_AUTH_REFRESH_TOKEN_ENDPOINT = "/api/auth/refreshToken"
|
|
|
|
# Research Clinic (RC) endpoints
|
|
API_RC_GET_ALL_ORGANIZATIONS_ENDPOINT = "/api/inclusions/getAllOrganizations"
|
|
API_RC_INCLUSION_STATISTICS_ENDPOINT = "/api/inclusions/inclusion-statistics"
|
|
API_RC_SEARCH_INCLUSIONS_ENDPOINT = "/api/inclusions/search"
|
|
API_RC_GET_RECORD_BY_PATIENT_ENDPOINT = "/api/records/byPatient"
|
|
API_RC_GET_SURVEYS_ENDPOINT = "/api/surveys/filter/with-answers"
|
|
API_RC_SEARCH_VISITS_ENDPOINT = "/api/visits/visits/search"
|
|
|
|
# GDD (Lab/Diagnostic) endpoints
|
|
API_GDD_GET_REQUEST_BY_TUBE_ID_ENDPOINT = "/api/requests/by-tube-id"
|
|
|
|
# ============================================================================
|
|
# THREADING & RETRY PARAMETERS
|
|
# ============================================================================
|
|
|
|
ERROR_MAX_RETRY = 10
|
|
WAIT_BEFORE_RETRY = 1
|
|
WAIT_BEFORE_NEW_BATCH_OF_RETRIES = 20
|
|
MAX_BATCHS_OF_RETRIES = 3
|
|
MAX_THREADS = 40
|
|
|
|
# Excel operation retry parameters (for handling transient xlwings/Excel failures)
|
|
# Applies to: SaveAs, Range.Select(), and other COM operations that can fail transiently on Excel 2013
|
|
EXCEL_COM_MAX_RETRIES = 3 # Maximum retry attempts for transient COM failures
|
|
EXCEL_COM_RETRY_DELAY = 0.5 # Delay in seconds between retries
|
|
|
|
# ============================================================================
|
|
# LOGGING CONFIGURATION
|
|
# ============================================================================
|
|
|
|
LOG_FILE_NAME = "dashboard.log"
|
|
|
|
# ============================================================================
|
|
# API CONFIGURATION
|
|
# ============================================================================
|
|
|
|
API_TIMEOUT = 60 # seconds - timeout for all API calls
|
|
|
|
# ============================================================================
|
|
# EXCEL EXPORT CONFIGURATION
|
|
# ============================================================================
|
|
|
|
# Output file conflict handling actions
|
|
OUTPUT_ACTION_OVERWRITE = "Overwrite"
|
|
OUTPUT_ACTION_INCREMENT = "Increment"
|
|
OUTPUT_ACTION_BACKUP = "Backup"
|
|
OUTPUT_ACTIONS = [OUTPUT_ACTION_OVERWRITE, OUTPUT_ACTION_INCREMENT, OUTPUT_ACTION_BACKUP]
|
|
|
|
# Excel export data source types
|
|
SOURCE_TYPE_INCLUSIONS = "Inclusions"
|
|
SOURCE_TYPE_ORGANIZATIONS = "Organizations"
|
|
SOURCE_TYPE_VARIABLE = "Variable"
|
|
SOURCE_TYPES = [SOURCE_TYPE_INCLUSIONS, SOURCE_TYPE_ORGANIZATIONS, SOURCE_TYPE_VARIABLE]
|
|
|
|
# Excel export target types (for data filling)
|
|
TARGET_TYPE_TABLE = "Table" # Excel structured table (ListObject) - has headers, supports Resize()
|
|
TARGET_TYPE_NAMED_RANGE = "NamedRange" # Simple named range - no headers, resize via Name.RefersTo
|
|
|
|
# ============================================================================
|
|
# UI FORMATTING (Progress bars)
|
|
# ============================================================================
|
|
|
|
BAR_N_FMT_WIDTH = 4
|
|
BAR_TOTAL_FMT_WIDTH = 4
|
|
BAR_TIME_WIDTH = 8
|
|
BAR_RATE_WIDTH = 10
|