136 lines
5.1 KiB
Python
136 lines
5.1 KiB
Python
"""
|
|
DO Dashboard - Centralized Constants Module
|
|
|
|
This module defines ALL constants used across the DO (Diagnostic Order) 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
|
|
- DO filters config
|
|
- UI formatting constants
|
|
"""
|
|
|
|
# ============================================================================
|
|
# FILE NAMES & PATHS
|
|
# ============================================================================
|
|
|
|
REQUESTS_FILE_NAME = "do_requests.json"
|
|
ORGANIZATIONS_FILE_NAME = "do_organizations.json"
|
|
OLD_FILE_SUFFIX = "_old"
|
|
CONFIG_FOLDER_NAME = "config"
|
|
|
|
# ============================================================================
|
|
# EXCEL CONFIGURATION FILES
|
|
# ============================================================================
|
|
|
|
DASHBOARD_CONFIG_FILE_NAME = "DO_Dashboard_Config.xlsx"
|
|
ORG_CENTER_MAPPING_FILE_NAME = "do_org_center_mapping.xlsx"
|
|
|
|
# ============================================================================
|
|
# TABLE NAMES (Excel sheets in DASHBOARD_CONFIG_FILE_NAME)
|
|
# ============================================================================
|
|
|
|
REQUESTS_MAPPING_TABLE_NAME = "Requests_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"
|
|
|
|
# ============================================================================
|
|
# DO FILTERS CONFIGURATION
|
|
# ============================================================================
|
|
|
|
# Named range in DASHBOARD_CONFIG_FILE_NAME containing the JSON filters object
|
|
# for the worklist API call (e.g. {"status": "all-admin", "study": "ENDOLIFE"})
|
|
DO_FILTERS = "DO_Filters"
|
|
|
|
# Number of requests per page for worklist pagination
|
|
DO_WORKLIST_PAGE_SIZE = 50
|
|
|
|
# ============================================================================
|
|
# API ENDPOINTS & AUTHENTICATION
|
|
# ============================================================================
|
|
|
|
IAM_URL = "https://api-auth.ziwig-connect.com"
|
|
GDD_URL = "https://api-lab.ziwig-connect.com"
|
|
GDD_APP_ID = "4f5ac063-6a22-4e2c-bda5-b50c0dddab79"
|
|
|
|
DEFAULT_USER_NAME = "ziwig-invest2@yopmail.com"
|
|
DEFAULT_PASSWORD = "pbrrA765$bP3beiuyuiyhiuy!agxagx"
|
|
|
|
# ============================================================================
|
|
# 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"
|
|
|
|
# GDD (Diagnostic Order) endpoints
|
|
API_DO_WORKLIST_ENDPOINT = "/api/requests/worklist-filter"
|
|
API_DO_REQUEST_DETAIL_ENDPOINT = "/api/requests" # + /{id}/validation
|
|
API_DO_PROFESSIONALS_ENDPOINT = "/api/entity-manager/meta/modele_fr/data/nodes/pro/nodes"
|
|
|
|
# ============================================================================
|
|
# 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)
|
|
EXCEL_COM_MAX_RETRIES = 3
|
|
EXCEL_COM_RETRY_DELAY = 0.5
|
|
|
|
# ============================================================================
|
|
# 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_REQUESTS = "Requests"
|
|
SOURCE_TYPE_ORGANIZATIONS = "Organizations"
|
|
SOURCE_TYPE_VARIABLE = "Variable"
|
|
SOURCE_TYPES = [SOURCE_TYPE_REQUESTS, 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
|