automatic generation of all plots with all combinations

This commit is contained in:
2026-02-03 15:03:57 +01:00
parent e44251c3d6
commit 2817ed240a
4 changed files with 135 additions and 22 deletions

View File

@@ -110,12 +110,13 @@ def get_filter_combinations(survey: QualtricsSurvey) -> list[dict]:
return combinations
def run_report(filters: dict, dry_run: bool = False) -> bool:
def run_report(filters: dict, name: str = None, dry_run: bool = False) -> bool:
"""
Run the report script with given filters.
Args:
filters: Dict of filter_name -> list of values
name: Name for this filter combination (used for .txt description file)
dry_run: If True, just print command without running
Returns:
@@ -123,6 +124,10 @@ def run_report(filters: dict, dry_run: bool = False) -> bool:
"""
cmd = [sys.executable, str(REPORT_SCRIPT)]
# Add filter-name for description file
if name:
cmd.extend(['--filter-name', name])
for filter_name, values in filters.items():
if values:
cmd.extend([f'--{filter_name}', json.dumps(values)])
@@ -166,7 +171,7 @@ def main():
print("\nDRY RUN - Commands that would be executed:")
for combo in combinations:
print(f"\n{combo['name']}:")
run_report(combo['filters'], dry_run=True)
run_report(combo['filters'], name=combo['name'], dry_run=True)
return
# Run each combination with progress bar
@@ -175,7 +180,7 @@ def main():
for combo in tqdm(combinations, desc="Running reports", unit="filter"):
tqdm.write(f"Running: {combo['name']}")
if run_report(combo['filters']):
if run_report(combo['filters'], name=combo['name']):
successful += 1
else:
failed.append(combo['name'])