Problem
Session notes are currently written to text files on the local filesystem via write_task_notes() in layouts.py (line 331). Each note is appended to a file at <local_data_dir>/<subject_id>/<subject_id>-<task_name>-notes.txt.
This has several drawbacks:
- Notes are only on the CTR machine's local disk -- not accessible from other machines or the database
- Notes are not queryable or searchable
- Notes can be lost if the local data directory is cleaned up or the machine is reimaged
- No association with the
log_task or log_session tables, so notes can't be correlated with other session data
Current flow
- GUI fires
_save_notes_ event (gui.py:448) or auto-saves empty notes on task completion (gui.py:523)
SessionController.save_notes() (session_controller.py:535) calls write_task_notes()
write_task_notes() (layouts.py:331) appends timestamped text to a .txt file
Proposed change
Store notes in a database table (e.g. log_task_notes) with columns for subject_id, staff_id, task_name, session_id, timestamp, and note text. Update save_notes() to write to the database instead of (or in addition to) the filesystem.
Problem
Session notes are currently written to text files on the local filesystem via
write_task_notes()inlayouts.py(line 331). Each note is appended to a file at<local_data_dir>/<subject_id>/<subject_id>-<task_name>-notes.txt.This has several drawbacks:
log_taskorlog_sessiontables, so notes can't be correlated with other session dataCurrent flow
_save_notes_event (gui.py:448) or auto-saves empty notes on task completion (gui.py:523)SessionController.save_notes()(session_controller.py:535) callswrite_task_notes()write_task_notes()(layouts.py:331) appends timestamped text to a.txtfileProposed change
Store notes in a database table (e.g.
log_task_notes) with columns for subject_id, staff_id, task_name, session_id, timestamp, and note text. Updatesave_notes()to write to the database instead of (or in addition to) the filesystem.