Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ The `lslautobids` command-line interface provides the main entry point for the a

#### Key Points

1. `lslautobids en-proj-config` and `lslautobids gen-dv-config` commands generate configuration files for the project and Dataverse, respectively. This allows users to set up their project and Dataverse connection details easily before running the conversion and upload process
1. `lslautobids gen-proj-config` and `lslautobids gen-dv-config` commands generate configuration files for the project and Dataverse, respectively. This allows users to set up their project and Dataverse connection details easily before running the conversion and upload process
2. The `lslautobids run` command executes the main conversion and upload process, using the configurations generated earlier. This command runs the entire pipeline from reading XDF files, converting them to BIDS format, integrating with DataLad, and uploading to Dataverse.
3. The `lslautobids help` command provides usage information for the CLI, listing available commands and their descriptions.
23 changes: 11 additions & 12 deletions docs/dataverse_integration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
### Dataverse Integration

#### 1. Dataverse Dataset Creation (`dataverse_dataset_create.py`)
#### 1. Generating dataset JSON Metadata (`generate_dataset_json.py`)

This module generates the `dataset.json` file required for creating a dataset in Dataverse. The function performs the following steps:

1. Gathers metadata from the project configuration file (<project_name>_config.toml) such as title, authors, description, license, etc.
2. Constructs a JSON structure that conforms to the Dataverse dataset metadata schema. This includes fields like title, author list, description, keywords, license, etc.
3. Writes the constructed JSON to a file named `dataset.json` in the project directory. This file is then used when creating the dataset in Dataverse.

#### 2. Dataverse Dataset Creation (`dataverse_dataset_create.py`)
This module handles the creation of a new dataset in Dataverse using the `pyDataverse` library. The function performs the following steps:

1. Initialize `dataset.json` file path and read the JSON content. (See section)
Expand All @@ -12,7 +20,7 @@ This module handles the creation of a new dataset in Dataverse using the `pyData
5. If no existing dataset is found, we create a new dataset using `api.create_dataset(parent_dataverse_name, ds.json())`. We then populate the returned dataset ID and DOI in the project configuration file (<project_name>_config.toml) for using in future runs.
6. This function returns the dataset DOI and status code ( 1= dataverse dataset exists, 0= new dataset created)

#### 2. Linking DataLad to Dataverse (`link_datalad_dataverse.py`)
#### 3. Linking DataLad to Dataverse (`link_datalad_dataverse.py`)
This module links the local DataLad dataset to the remote Dataverse dataset as a sibling. The function performs the following steps:
1. It first checks if the Dataverse is already created in the previous runs or it is just created in the current run (flag==0). If flag==0, it proceeds to link the DataLad dataset to Dataverse.
2. It runs the command `datalad add-sibling-dataverse dataverse_base_url doi_id`. This command adds the Dataverse as a sibling to the local DataLad dataset, allowing for synchronization and data management between the two. For lslautobids, we currently only allow to deposit data to Dataverse. In future version, we shall also add user controlled options for adding other siblings like github, gitlab, OpenNeuro, AWS etc.
Expand All @@ -21,16 +29,7 @@ We chose Dataverse as it serves as both a repository and a data sharing platform

Dataverse also provides features like versioning, but only after we publish the dataset. In our case, we keep the dataset in draft mode until we are ready to publish it (i.e. until all the participants/subjects data is uploaded). So we use DataLad for version control during the development and conversion phase to assure complete provenance of the dataset.


#### 4 Generating dataset JSON Metadata (`generate_dataset_json.py`)

This module generates the `dataset.json` file required for creating a dataset in Dataverse. The function performs the following steps:

1. Gathers metadata from the project configuration file (<project_name>_config.toml) such as title, authors, description, license, etc.
2. Constructs a JSON structure that conforms to the Dataverse dataset metadata schema. This includes fields like title, author list, description, keywords, license, etc.
3. Writes the constructed JSON to a file named `dataset.json` in the project directory. This file is then used when creating the dataset in Dataverse.

#### 5. Upload to Dataverse (`upload_to_dataverse.py`)
#### 4. Upload to Dataverse (`upload_to_dataverse.py`)

This module handles the uploading of files from the local DataLad dataset to the remote Dataverse dataset. The function performs the following steps:
1. It runs the command `datalad push --to dataverse` to push the files from the local DataLad dataset to the linked Dataverse dataset. This command uploads all changes (new files, modified files) to Dataverse.
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Tests will be added continuously as new features are added and existing features

### Running Tests

To run the tests, we recommend to use `uv run pytest` (caveat, for some reason sometimes tests fail if they are all run at the same time. you can then run them via `uv run pytest tests/testcase/test_main_functionality` and they will work).
Before running the tests with `uv`, install the project in editable mode using `uv pip install --editable ./`. Then run the tests with `uv run pytest` (caveat, sometimes running all tests at once fails; in that case, you can run only the main functionality tests via `uv run pytest tests/test_main_functionality`).

These tests ensure that each component functions as expected and that the overall pipeline works seamlessly. This tests will also be triggered automatically on each push or PR to the main repository using GitHub Actions.
1 change: 1 addition & 0 deletions sample_data/bids/test-project/.bidsignore
1 change: 1 addition & 0 deletions sample_data/bids/test-project/README
1 change: 1 addition & 0 deletions sample_data/bids/test-project/dataset_description.json
1 change: 1 addition & 0 deletions sample_data/bids/test-project/participants.json
1 change: 1 addition & 0 deletions sample_data/bids/test-project/participants.tsv
6 changes: 3 additions & 3 deletions tests/pytest-autobids_config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BIDS_ROOT: /home/behinger/projects/LSLAutoBIDS/tests/data/bids
PROJECT_OTHER_ROOT: /home/behinger/projects/LSLAutoBIDS/tests/data/project_other
PROJECT_ROOT: /home/behinger/projects/LSLAutoBIDS/tests/data/projects
BIDS_ROOT: /Users/xuyg/GitHub/LSLAutoBIDS/tests/data/bids
PROJECT_OTHER_ROOT: /Users/xuyg/GitHub/LSLAutoBIDS/tests/data/project_other
PROJECT_ROOT: /Users/xuyg/GitHub/LSLAutoBIDS/tests/data/projects
3 changes: 3 additions & 0 deletions tests/test_main_functionality/test_main_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def test_process_main_functionality(setup_project, monkeypatch):

monkeypatch_paths(monkeypatch,paths)

from lslautobids.config_logger import get_logger
logger = get_logger(project_name)
logger.debug(f" Starting test_process_main_functionality in {project_name} ")

# Reset sys.argv to something that lslautobids.main.main() expects
# this effectively removes the -c from setup_project
Expand Down
4 changes: 4 additions & 0 deletions tests/test_old_suffix/test_old_suffix.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def test_process_new_files_with_old_suffix(setup_project, monkeypatch):
paths = get_root_paths(__file__)

monkeypatch_paths(monkeypatch,paths)

from lslautobids.config_logger import get_logger
logger = get_logger(project_name)
logger.debug(f" Starting test_process_new_files_with_old_suffix in {project_name} ")

# Reset sys.argv to something that lslautobids.main.main() expects
sys.argv = [
Expand Down