Skip to main content

A set of tools to create and manage standardized forms for eLabFTW

Project description

For the full documentation, see readthedocs

elabforms

A set of tools to create and manage standardized forms for eLabFTW.


Create a virtual environment

python3 -m venv myenv
source myenv/bin/activate

Installation

You will need template_part files to generate the final template. These files are located in the elabforms_INTProjects and elabforms_BIDSMetadata repositories — private Git repositories at NIT.

Reminder: A template_part is an elabform with a single groupfield. You need to create a template_file_list.csv file listing the parts you want to concatenate, in this order, for example:

template_part_Example_1.json
template_part_Example_2.json
...
template_part_Example_N.json

Each line corresponds to one template part file.


User mode

Install the package from Test PyPI:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple elabforms==0.0.6

or with pip:

pip install elabforms==0.0.8

Usage

  • Test the installation by running:

    eform --help
    
  • To create a new form, run:

    eform template_file_list.csv template_generated.json
    

## Example
Assuming you have a file `template_file_list.csv` with the following content:
```csv
template_part_Example_1.json
template_part_Example_2.json

This will generate the file template_generated.json which will contain the content of the two files concatenated together.


 let 's template_part_Example_1.json` ![GENERIC_BIDS_SESSION](docs/GNERIC_BIDS_SESSION.png) 

with content:
```json
{
    "elabftw": {
        "extra_fields_groups": [
            {
                "id": 1,
                "name": "GENERIC_BIDS_SESSION"
            }
        ]
    },
    "extra_fields": {
        "session_id": {
            "type": "text",
            "value": "",
            "group_id": 1,
            "position": 0,
            "required": true,
            "description": "Ex: '01 or predrug or 20231206'"
        },
        "Session duration": {
            "type": "number",
            "value": "",
            "group_id": 1,
            "position": 3,
            "description": "The duration of the session [in minutes]",
            "blank_value_on_duplicate": true
        }
    }
}

and template_part_Example_2.json GENERIC_BIDS_SESSION, with the following content:

{
  "elabftw": {
    "display_main_text": true,
    "extra_fields_groups": [
      {
        "id": 2,
        "name": "Run "
      }
    ]
  },
  "extra_fields": {
    "TaskName": {
      "type": "text",

      "group_id": 2,
      "position": 0,

      "description": "Code name of the task (no space and only alphanumeric characters).\n Ex: 'rest or facesnback or headnodding'"
    },
    "RunNumber": {
      "type": "text",
      "value": "",
      "group_id": 2,
      "position": 2
    },
    "StartTime": {
      "type": "text",
      "value": "",
      "group_id": 2
    },
    "RunComment": {
      "type": "text",
      "value": "",
      "group_id": 2,
      "position": 3,
      "description": "Comment about the subject behavior during the run."
    },
    "TaskDescription": {
      "type": "text",
      "value": "  ",
      "group_id": 2,
      "position": 1,
      "description": "Description of the task"
    }
  }
}

This will generate the following file " template_generated.json" GENERIC_BIDS_SESSION,

which will contain the content of the two files template_part_Example_1.json and template_part_Example_2.json concatenated together.

{
    "elabftw": {
        "extra_fields_groups": [
            {
                "id": 1,
                "name": "GENERIC_BIDS_SESSION"
            },
            {
                "id": 2,
                "name": "Run "
            }
        ]
    },
    "extra_fields": {
        "session_id": {
            "type": "text",
            "value": "",
            "group_id": 1,
            "position": 0,
            "required": true,
            "description": "Ex: '01 or predrug or 20231206'"
        },
        "Session duration": {
            "type": "number",
            "value": "91",
            "group_id": 1,
            "position": "3",
            "description": "The duration of the session [in minutes]",
            "blank_value_on_duplicate": true
        },
        "TaskName": {
            "type": "text",
            "group_id": 2,
            "position": 0,
            "description": "Code name of the task (no space and only alphanumeric characters).\n Ex: 'rest or facesnback or headnodding'"
        },
        "RunNumber": {
            "type": "text",
            "value": "",
            "group_id": 2,
            "position": 2
        },
        "StartTime": {
            "type": "text",
            "value": "",
            "group_id": 2
        },
        "RunComment": {
            "type": "text",
            "value": "",
            "group_id": 2,
            "position": 3,
            "description": "Comment about the subject behavior during the run."
        },
        "TaskDescription": {
            "type": "text",
            "value": "  ",
            "group_id": 2,
            "position": 1,
            "description": "Description of the task"
        }
    }
}
```bash

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elabforms-0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elabforms-0.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file elabforms-0.1.tar.gz.

File metadata

  • Download URL: elabforms-0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for elabforms-0.1.tar.gz
Algorithm Hash digest
SHA256 5958d721c41a334512b678f6c11ec55ec31220ccb764d99ee1c2078b900db1a4
MD5 463ee35039c23ca3b473be6b7480c314
BLAKE2b-256 5fb867691c98f69982e9ac143c009f9fa79425a48723d93187f8db4db68c2822

See more details on using hashes here.

File details

Details for the file elabforms-0.1-py3-none-any.whl.

File metadata

  • Download URL: elabforms-0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for elabforms-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29226e27d4cc271e6b16b1c3cc8fbbd51cca11d53bfe91eb2578de7f4967b758
MD5 8303767f773e3adc60da32e37d5db864
BLAKE2b-256 3be9b023350819ef3d57ded5477308967734e32a9556e6a6dbd329975a9d0be7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page