Qustionnaires Unliked Patient filter
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
config/eb_dashboard_extended_template - Prod.xlsx
Normal file
BIN
config/eb_dashboard_extended_template - Prod.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -767,7 +767,7 @@ def _execute_custom_function(function_name, args, output_inclusion):
|
||||
# Unified conditional function
|
||||
# Syntax: ["operator", arg1, arg2_optional, result_if_true, result_if_false]
|
||||
# Operators: "is_true", "is_false", "all_true", "any_true", "is_defined", "is_undefined", "all_defined", "==", "!=", ">", ">=", "<", "<="
|
||||
# Sentinel propagation: "undefined" (inconnu) > "N/A" (non applicable) > vraie valeur.
|
||||
# Sentinel propagation: "undefined" (unknown) > "N/A" (not applicable) > real value.
|
||||
|
||||
if not args or len(args) < 4:
|
||||
return "$$$$ Argument Error: if_then_else requires at least 4 arguments"
|
||||
@@ -1217,6 +1217,17 @@ def get_all_questionnaires_by_patient(patient_id, record_data):
|
||||
q_name = get_nested_value(item, path=["questionnaire", "name"])
|
||||
q_category = get_nested_value(item, path=["questionnaire", "category"])
|
||||
answers = get_nested_value(item, path=["answers"], default={})
|
||||
|
||||
# ── UNLINKED PATIENT FILTER ─────────────────────────────────────────────
|
||||
# If answers.patient is missing, null, or does not match the requested
|
||||
# patient_id, the questionnaire is considered unlinked → clear answers
|
||||
# to prevent use of orphaned data.
|
||||
# (disable: comment out the block below)
|
||||
answers_patient = answers.get("subject") if isinstance(answers, dict) else None
|
||||
if not answers_patient or answers_patient != patient_id:
|
||||
answers = {}
|
||||
# ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
if q_id:
|
||||
results[q_id] = {
|
||||
"questionnaire": {
|
||||
@@ -1556,9 +1567,9 @@ def main():
|
||||
organizations_list.sort(key=lambda org: (-org.get('patients_count', 0), org.get('name', '')))
|
||||
|
||||
# ╔══════════════════════════════════════════════════════════════════╗
|
||||
# ║ TEST INSTRUMENTATION — À SUPPRIMER AVANT MISE EN PRODUCTION ║
|
||||
# ║ Limite le tableau aux organisations aux rangs 33 et 34 ║
|
||||
# ║ (indices 32 et 33, après tri décroissant par patients_count) ║
|
||||
# ║ TEST INSTRUMENTATION — REMOVE BEFORE PRODUCTION ║
|
||||
# ║ Limits the table to organizations at ranks 33 and 34 ║
|
||||
# ║ (indices 32 and 33, after descending sort by patients_count) ║
|
||||
# ╚══════════════════════════════════════════════════════════════════╝
|
||||
# organizations_list = [org for i, org in enumerate(organizations_list) if i in (32, 33)]
|
||||
# ══════════════════════════════════════════════════════════════════
|
||||
|
||||
@@ -754,8 +754,8 @@ def _apply_value_replacement(value, replacements):
|
||||
return value
|
||||
|
||||
for value_before, value_after in replacements:
|
||||
# bool est une sous-classe de int en Python (True == 1, False == 0),
|
||||
# donc on bloque le match si l'un est bool et pas l'autre.
|
||||
# bool is a subclass of int in Python (True == 1, False == 0):
|
||||
# reject the match if one side is bool and the other is not.
|
||||
if isinstance(value, bool) != isinstance(value_before, bool):
|
||||
continue
|
||||
if value == value_before:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user