Skip to content

Monitor DAQ directory and integrate with Google Sheets#6

Open
jannis-maiwald wants to merge 62 commits into
mainfrom
watch_acq_times
Open

Monitor DAQ directory and integrate with Google Sheets#6
jannis-maiwald wants to merge 62 commits into
mainfrom
watch_acq_times

Conversation

@jannis-maiwald

Copy link
Copy Markdown
Member

Implement a script to monitor DAQ acquisition runs, log start and end times, and sync data with Google Sheets. Added error handling, input validation, and documentation throughout the codebase.

jannis-maiwald and others added 30 commits July 15, 2025 18:57
Monitors a DAQ directory (and subfolders) to detect acquisition runs by:
- Printing the acquisition START time when the first .root file appears in a run folder (based on settings.xml mtime)
- Printing the acquisition END time when a .txt file appears in that run folder (based on its ctime or mtime)
- On startup, scans existing run folders so you still see START and STOP for runs in progress or completed before the script began.
- Watcher now uses the settings.xml and *.txt directly, ignoring the .root files.
- plus some refactoring
Added heartbeat spinner
Google Sheets integration utilities for updating Radiation - Nuclear particle master Google Sheets using gspread.

Handles loading existing run names, appending new runs,
updating start/end times, and maintaining row numbers.
Configuration (spreadsheet ID, sheet name) is loaded
from an external JSON config file (e.g., sheet_config.json),
while credentials.json remains a separate service account key file.
Monitors a DAQ directory (and subfolders) to detect acquisition runs by:
  - Printing the acquisition START time when a new settings.xml appears
  - Printing the acquisition END time when a dedicated .txt file appears
  - On startup, scans existing run folders and syncs them into Google Sheets
  - After initial sync, listens for new START/STOP events and updates the sheet
- Remove all hard-coded column indices in google_sheet_utils.
- Load header names from the sheet’s first row using config file keys, build a header→column map, and fetch the entire sheet once.
- Validate run_name and datetime inputs
- Implement retry helper for Sheets API writes
- Improve readability, formatting & add type hints
- aggregate all exact‐match files into one “✅ Exact matches” line
- list all files with differences in a single “⚠️ Differences detected in” line
- show up to N detailed diffs per differing file
…hod to handle blank fields

refactor(watch_acq_times): Remove deprecated file and update event handling to use new utility functions
…and improved logging for better readability and maintainability
…function for better readability and maintainability
…mic updates and improve handling of multiple fields
…to report missing parameters in both current and reference files
…tree): update ignore tag handling to support multiple tags
…, process_run_folder, and update_run_row methods
… adding refresh parameter to find_run_row, append_run, and update_run_row methods
… reverse mapping from values to line numbers
…and clarify expected naming conventions

refactor(GoogleSheet): improve error handling for config and credentials loading
Comment thread caen-watch_acq_times.py Outdated
Comment thread caen-watch_acq_times.py Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment on lines +1 to +4
---
description: 'Python coding conventions and guidelines'
applyTo: '**/*.py'
---

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file is best kept for individual co-pilot preferences rather than put as repo standard. For example, I don't like to use typing annotations as i find it makes the code harder to read. I wouldn't want my copilot to start doing that.

Comment thread caen-watch_acq_times.py
Comment thread caen-watch_acq_times.py
Comment thread libs/google_sheet_utils.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants