Skip to content

Commit 2111315

Browse files
authored
Merge pull request #37 from ssciwr/update_docs
update docs
2 parents 2bb48a0 + 6e659a4 commit 2111315

File tree

7 files changed

+98
-42
lines changed

7 files changed

+98
-42
lines changed

README.md

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,51 @@
11
# mease-elabftw
22

3+
[![pypi](https://img.shields.io/pypi/v/mease-elabftw.svg)](https://pypi.org/project/mease-elabftw)
4+
[![docs](https://readthedocs.org/projects/mease-elabftw/badge/?version=latest)](https://mease-elabftw.readthedocs.io/en/latest/?badge=latest)
35
[![tests](https://github.com/ssciwr/mease-elabftw/workflows/Tests/badge.svg)](https://github.com/ssciwr/mease-elabftw/actions?query=workflow%3ATests)
46
[![codecov](https://codecov.io/gh/ssciwr/mease-elabftw/branch/main/graph/badge.svg?token=xJTHCFXzrz)](https://codecov.io/gh/ssciwr/mease-elabftw)
5-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ssciwr_mease-elabftw&metric=alert_status)](https://sonarcloud.io/dashboard?id=ssciwr_mease-elabftw)
6-
[![Documentation Status](https://readthedocs.org/projects/mease-elabftw/badge/?version=latest)](https://mease-elabftw.readthedocs.io/en/latest/?badge=latest)
7+
[![sonar](https://sonarcloud.io/api/project_badges/measure?project=ssciwr_mease-elabftw&metric=alert_status)](https://sonarcloud.io/dashboard?id=ssciwr_mease-elabftw)
78

8-
Python library for interacting with [eLabFTW](https://www.elabftw.net/) experiments:
9+
A Python library for interacting with [eLabFTW](https://www.elabftw.net/) experiments:
910

1011
- Create [NWB](https://nwb-schema.readthedocs.io/en/latest/) metadata from an eLabFTW experiment
11-
- Extract [metadata](https://doc.elabftw.net/metadata.html) from linked database items
1212
- Upload files (e.g. analysis result from HPC) to an eLabFTW experiment
1313
- List eLabFTW experiments from the command line
1414

1515
## Setup
1616

17-
To install:
18-
1917
```bash
20-
python -m pip install git+https://github.com/ssciwr/mease-elabftw
18+
python -m pip install mease-elabftw
2119
```
2220

23-
You also need to generate an API key in eLabFTW (User Panel -> API Keys -> GENERATE AN API KEY),
21+
To authenticate requests to the eLabFTW server you also need to generate an API key in eLabFTW (User Panel -> API Keys -> GENERATE AN API KEY),
2422
and then set the environment variable `ELABFTW_TOKEN` to this key, e.g.
2523

2624
```bash
2725
export ELABFTW_TOKEN=abc123abc123abc123
2826
```
2927

30-
This key is needed to authenticate requests to the eLabFTW server.
31-
3228
## Use in Python
3329

3430
Get nwb metadata from an elabftw experiment to use in [mease-lab-to-nwb](https://github.com/ssciwr/mease-lab-to-nwb):
3531

3632
```pycon
3733
>>> import mease_elabftw
38-
>>> from pprint import pprint
39-
>>> pprint(mease_elabftw.list_experiments("Liam"))
40-
['163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)',
41-
'156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)']
42-
>>> pprint(mease_elabftw.get_nwb_metadata(156))
43-
{'Ecephys': {},
44-
'NWBFile': {'experimenter': 'Liam Keegan',
45-
'identifier': '20211001-8b6f100d66f4312d539c52620f79d6a503c1e2d1',
46-
'institution': 'Heidelberg University, Physiology and '
47-
'Pathophysiology',
48-
'lab': 'Medical Biophysics, Groh/Mease',
49-
'session_description': 'test fake experiment with json metadata',
50-
'session_start_time': '2021-10-01 11:13:47',
51-
'virus': 'AAVretr ChR2-tdTomato:\n'
52-
' * Virus in -80 storage: AAVrg-CAG-hChR2-tdTomato (AAV '
53-
'Retrograde)\n'
54-
' * Origin: Addgene\n'
55-
' * Comments: retrograde\n'
56-
' * Expression Quality: \n'
57-
' * product number: \n'
58-
'AAVretr Flpo:\n'
59-
' * Virus in -80 storage: AAVretr EF1a-Flpo\n'
60-
' * Origin: Addgene\n'
61-
' * Comments: retrograde Flip\n'
62-
' * Expression Quality: \n'
63-
' * product number: 55637-AAVrg\n'},
64-
'Subject': {}}
34+
>>> mease_elabftw.list_experiments("Liam")
35+
['163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)', '156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)']
36+
>>> metadata = mease_elabftw.get_nwb_metadata(156)
37+
>>> metadata["NWBFile"]["session_description"]
38+
test fake experiment with json metadata
39+
>>> metadata["NWBFile"]["identifier"]
40+
20211001-8b6f100d66f4312d539c52620f79d6a503c1e2d1
6541
```
6642

6743
## Use from terminal
6844

6945
List all experiments on elabftw belonging to user "Liam":
7046

7147
```bash
72-
liam@ssc:~$ elabftw-list Liam
48+
$ elabftw-list Liam
7349
163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)
7450
156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)
7551
```

docs/cli.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Command Line Interface
2+
======================
3+
4+
The ``elabftw-list`` command prints a list of experiments:
5+
6+
.. code-block:: bash
7+
8+
$ elabftw-list --help
9+
Usage: elabftw-list [OPTIONS] [OWNER]
10+
11+
Prints a list of eLabFTW experiments belonging to OWNER
12+
13+
If OWNER is not specified, all experiments are printed.
14+
15+
Options:
16+
--help Show this message and exit.
17+
18+
19+
Example of use:
20+
21+
.. code-block:: bash
22+
23+
$ elabftw-list Liam
24+
163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)
25+
156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)

docs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ A Python library for interacting with `eLabFTW <https://www.elabftw.net/>`_ expe
1212
:caption: Contents
1313

1414
install
15+
cli
16+
python
17+
source
1518

1619
API Reference
1720
-------------

docs/install.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ To install using pip:
55

66
.. code-block:: bash
77
8-
python -m pip install git+https://github.com/ssciwr/mease-elabftw
8+
pip install mease-elabftw
99
1010
You also need to generate an API key in eLabFTW (User Panel -> API Keys -> GENERATE AN API KEY),
11-
and then set the environment variable `ELABFTW_TOKEN` to this key, e.g.
11+
and then set the environment variable ``ELABFTW_TOKEN`` to this key, e.g.
1212

1313
.. code-block:: bash
1414
15-
export ELABFTW_TOKEN=abc123abc123abc123
15+
export ELABFTW_TOKEN=abc123abc123abc123
1616
1717
This key is needed to authenticate requests to the eLabFTW server.

docs/python.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Python Interface
2+
================
3+
4+
To import the library:
5+
6+
.. code-block:: python
7+
8+
>>> import mease_elabftw
9+
10+
11+
Listing experiments
12+
-------------------
13+
14+
To get a list of the experiments belong to user "Liam":
15+
16+
.. code-block:: python
17+
18+
>>> import mease_elabftw
19+
>>> from pprint import pprint
20+
>>> pprint(mease_elabftw.list_experiments("Liam"))
21+
['163: test fake experiment without json metadata (Liam Keegan, 2021-10-07)',
22+
'156: test fake experiment with json metadata (Liam Keegan, 2021-10-01)']
23+
24+
25+
NWB metadata
26+
------------
27+
28+
To get a dict of the NWB metadata of the experiment with id ``156``:
29+
30+
.. code-block:: python
31+
32+
>>> import mease_elabftw
33+
>>> metadata = mease_elabftw.get_nwb_metadata(156)
34+
>>> metadata["NWBFile"]["session_description"]
35+
test fake experiment with json metadata
36+
>>> metadata["NWBFile"]["identifier"]
37+
20211001-8b6f100d66f4312d539c52620f79d6a503c1e2d1
38+
39+
Upload a file
40+
-------------
41+
42+
To upload the file "results.csv" to the experiment with id ``156``:
43+
44+
.. code-block:: python
45+
46+
>>> import mease_elabftw
47+
mease_elabftw.upload_file(156, "results.csv")

docs/source.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Source code
2+
===========
3+
4+
- Source code: `github.com/ssciwr/mease-elabftw <https://github.com/ssciwr/mease-elabftw/>`_
5+
- License: `MIT <https://raw.githubusercontent.com/ssciwr/mease-elabftw/main/LICENSE>`_

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="mease_elabftw",
11-
version="0.0.4",
11+
version="0.0.5",
1212
author="Liam Keegan",
1313
author_email="[email protected]",
1414
description="Extracts metadata from eLabFTW experiments",

0 commit comments

Comments
 (0)