-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: ## Changes description. This PR adds three new tables in the database to store raw data collected during experiments. The new tables are shown in the following figure: <p align="center"> <img alt="Database structure" src="https://i.imgur.com/lr7NTSj.png" width="80%"> </p> The specific changes in the code are in 6 different files, described below: 1. `aepsych/database/tables.py`: Add three new tables structures to the database: 1. Raw data table: fact table for raw data collected during experiments. 2. Param table: dimension table for parameters used in the experiment. 3. Outcome table: dimension table for outcomes of the experiment. 2. `aepsych/database/db.py`: Integrates these new tables into the database. Methods to save data, retrieve data, and update the from the tables are included. Also, there is a new method `generate_experiment_table`, which generates a new table with raw data for a given experiment id. This table is created within the database and intended to make it easy to access an experiment's data. An example of this table structure: | iteration_id | theta1 | theta2 | outcome_0 | outcome_1 | timestamp | |-------------: |-------: |-------: |----------: |----------: |---------------------------: | | 1 | 1.0 | 0.0 | 0.0 | -10.0 | 2022-10-17 10:52:23.757922 | | 2 | 3.0 | 2.0 | 1.0 | -7.5 | 2022-10-17 10:52:23.857462 | | 3 | 5.0 | 4.0 | 0.0 | -5.0 | 2022-10-17 10:52:23.949986 | | 4 | 7.0 | 6.0 | 1.0 | -2.5 | 2022-10-17 10:52:24.041166 | 4. `aepsych/server/server.py`: Saves experiment results when the `tell()` method is used in the server class, and it's not a replay. 5. `aepsych/tests/test_db.py`: Add tests for the new tables. 6. `aepsych/tests/test_integration`: These tests check that the server can handle different experiments (multi/single stimuli, multi/single outcome). They ensure that the data is correctly stored in the database tables (raw, param, and outcome). It also checks that the experiment table is correctly populated (generate_experiment_table method). The PR #184 adds the descriptions of the DB changes to the `For Developers/Data Overview section`. ## Associated Issue Fixes #34 ## To-Do - [x] Implement tests for new table. - [x] Create `--update` method to apply these changes to old databases. - This goes in a new PR. Associated branch: https://github.com/GabrielMissael/aepsych/tree/update_database - [x] The outcome is not necessarily binary! - [x] Allow multiple stimuli per experiment - [x] Allow multiple outcomes per experiment Pull Request resolved: #165 Reviewed By: crasanders Differential Revision: D40518350 fbshipit-source-id: 12fda3a8db253b14108b27ddfe44bea6cedcf945
- Loading branch information
1 parent
da07de4
commit c9a29a1
Showing
8 changed files
with
681 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.