Skip to content

Move session notes from filesystem to database #635

Description

@lwhite1

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

  1. GUI fires _save_notes_ event (gui.py:448) or auto-saves empty notes on task completion (gui.py:523)
  2. SessionController.save_notes() (session_controller.py:535) calls write_task_notes()
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    High-PriorityImportant issues that should be addressed soonenhancementNew feature or requestlaptopSingle-machine / laptop deployment

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions