Drafts are excluded by default
This commit is contained in:
@@ -149,7 +149,7 @@ _user_interaction_lock = threading.Lock()
|
||||
# Global variables (mutable, set at runtime - not constants)
|
||||
inclusions_mapping_config = []
|
||||
organizations_mapping_config = []
|
||||
_exclude_drafts = False # Set by --exclude-drafts CLI arg if provided
|
||||
_include_drafts = False # Set by --include-drafts CLI arg if provided
|
||||
excel_export_config = None
|
||||
excel_export_enabled = False
|
||||
|
||||
@@ -184,10 +184,10 @@ if "--config" in sys.argv:
|
||||
else:
|
||||
set_dashboard_config_path_override(os.path.join(get_config_path(), _raw_config_path))
|
||||
|
||||
# Handle --exclude-drafts flag (remove from sys.argv to preserve positional args)
|
||||
_exclude_drafts = "--exclude-drafts" in sys.argv
|
||||
if _exclude_drafts:
|
||||
sys.argv.remove("--exclude-drafts")
|
||||
# Handle --include-drafts flag (remove from sys.argv to preserve positional args)
|
||||
_include_drafts = "--include-drafts" in sys.argv
|
||||
if _include_drafts:
|
||||
sys.argv.remove("--include-drafts")
|
||||
|
||||
# --- Progress Bar Configuration ---
|
||||
# NOTE: BAR_N_FMT_WIDTH, BAR_TOTAL_FMT_WIDTH, BAR_TIME_WIDTH, BAR_RATE_WIDTH
|
||||
@@ -1258,8 +1258,8 @@ def get_all_questionnaires_by_patient(patient_id, record_data):
|
||||
# ── DRAFT ANSWERS FILTER ────────────────────────────────────────────────
|
||||
# "Draft" answers have a missing or mismatched subject (patient id):
|
||||
# they are not yet submitted and should not be treated as valid patient data.
|
||||
# Activated via --exclude-drafts CLI flag.
|
||||
if _exclude_drafts:
|
||||
# Active by default; use --include-drafts CLI flag to disable.
|
||||
if not _include_drafts:
|
||||
answers_patient = answers.get("subject") if isinstance(answers, dict) else None
|
||||
if not answers_patient or answers_patient != patient_id:
|
||||
answers = {}
|
||||
|
||||
Reference in New Issue
Block a user