pyPhasesRecordloaderAlice 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyphasesrecordloaderalice-0.1.2/.gitlab-ci.yml +111 -0
- pyphasesrecordloaderalice-0.1.2/LICENSE +21 -0
- pyphasesrecordloaderalice-0.1.2/MANIFEST.in +3 -0
- pyphasesrecordloaderalice-0.1.2/PKG-INFO +67 -0
- pyphasesrecordloaderalice-0.1.2/README.md +39 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/Plugin.py +13 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/__init__.py +2 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/config.yaml +97 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/recordLoaders/AliceRMLLoader.py +343 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/recordLoaders/AliceTextReportLoader.py +456 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/recordLoaders/RecordLoaderAlice.py +222 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice/recordLoaders/__init__.py +0 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice.egg-info/PKG-INFO +67 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice.egg-info/SOURCES.txt +18 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice.egg-info/dependency_links.txt +1 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice.egg-info/requires.txt +4 -0
- pyphasesrecordloaderalice-0.1.2/pyPhasesRecordloaderAlice.egg-info/top_level.txt +2 -0
- pyphasesrecordloaderalice-0.1.2/setup.cfg +4 -0
- pyphasesrecordloaderalice-0.1.2/setup.py +25 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
image: python:3.13-alpine
|
|
2
|
+
|
|
3
|
+
variables:
|
|
4
|
+
PROJECTNAME: $CI_PROJECT_NAME
|
|
5
|
+
|
|
6
|
+
stages:
|
|
7
|
+
- test
|
|
8
|
+
- release
|
|
9
|
+
|
|
10
|
+
test:
|
|
11
|
+
stage: test
|
|
12
|
+
cache: {}
|
|
13
|
+
before_script:
|
|
14
|
+
- apk update
|
|
15
|
+
- apk add build-base
|
|
16
|
+
script:
|
|
17
|
+
- pip install -U -r requirements.txt
|
|
18
|
+
- pip install -U coverage
|
|
19
|
+
- python -m coverage run -m unittest discover -s tests -p "test_*.py"
|
|
20
|
+
- python -m coverage report --data-file=.coverage
|
|
21
|
+
- python -m coverage xml --data-file=.coverage -o cov/coverage.xml
|
|
22
|
+
- python -m coverage html --data-file=.coverage -d cov/htmlcov
|
|
23
|
+
only:
|
|
24
|
+
- pushes
|
|
25
|
+
coverage: '/TOTAL.*\s+(\d+\%)/'
|
|
26
|
+
artifacts:
|
|
27
|
+
paths:
|
|
28
|
+
- :./cov/
|
|
29
|
+
reports:
|
|
30
|
+
coverage_report:
|
|
31
|
+
coverage_format: cobertura
|
|
32
|
+
path: cov/coverage.xml
|
|
33
|
+
pypi:
|
|
34
|
+
stage: release
|
|
35
|
+
environment: pypi
|
|
36
|
+
before_script:
|
|
37
|
+
- apk update
|
|
38
|
+
- apk add build-base
|
|
39
|
+
cache: {}
|
|
40
|
+
id_tokens:
|
|
41
|
+
PYPI_ID_TOKEN:
|
|
42
|
+
aud: pypi
|
|
43
|
+
variables:
|
|
44
|
+
APP_VERSION: $CI_COMMIT_TAG
|
|
45
|
+
script:
|
|
46
|
+
- sed -i "s/v0.0.0/${APP_VERSION}/g" setup.py
|
|
47
|
+
- pip install -U -r requirements.txt
|
|
48
|
+
- pip install -U twine pip setuptools
|
|
49
|
+
- python setup.py sdist
|
|
50
|
+
- twine upload dist/*
|
|
51
|
+
rules:
|
|
52
|
+
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?(-\S*)?$/'
|
|
53
|
+
|
|
54
|
+
make-badge:
|
|
55
|
+
before_script:
|
|
56
|
+
- apk update
|
|
57
|
+
- apk add jq curl
|
|
58
|
+
stage: release
|
|
59
|
+
variables:
|
|
60
|
+
APP_VERSION: $CI_COMMIT_TAG
|
|
61
|
+
script:
|
|
62
|
+
- |
|
|
63
|
+
if echo "$APP_VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
64
|
+
badgename="version"
|
|
65
|
+
else
|
|
66
|
+
badgename="pre--release"
|
|
67
|
+
APP_VERSION=$(echo "$APP_VERSION" | sed 's/-/--/g')
|
|
68
|
+
fi
|
|
69
|
+
- |
|
|
70
|
+
# Use BADGETOKEN if available, otherwise try CI_JOB_TOKEN (may have limited permissions)
|
|
71
|
+
if [ -n "$BADGETOKEN" ]; then
|
|
72
|
+
AUTH_HEADER="PRIVATE-TOKEN: ${BADGETOKEN}"
|
|
73
|
+
echo "Using BADGETOKEN for authentication"
|
|
74
|
+
else
|
|
75
|
+
AUTH_HEADER="JOB-TOKEN: ${CI_JOB_TOKEN}"
|
|
76
|
+
echo "Warning: BADGETOKEN not set, trying CI_JOB_TOKEN (may not work for badge updates)"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
echo "Fetching badges for project ${CI_PROJECT_ID}..."
|
|
80
|
+
response=$(curl -s -w "\n%{http_code}" --header "$AUTH_HEADER" "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/badges?name=${badgename}")
|
|
81
|
+
http_code=$(echo "$response" | tail -n1)
|
|
82
|
+
body=$(echo "$response" | sed '$d')
|
|
83
|
+
|
|
84
|
+
echo "HTTP Status: $http_code"
|
|
85
|
+
echo "Response: $body"
|
|
86
|
+
|
|
87
|
+
if [ "$http_code" != "200" ]; then
|
|
88
|
+
echo "Error: Failed to fetch badges (HTTP $http_code)"
|
|
89
|
+
echo "Please ensure BADGETOKEN is set in CI/CD variables with 'api' scope"
|
|
90
|
+
exit 1
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
version_badge_id=$(echo "$body" | jq -r "map(select(.name == \"$badgename\"))[0].id // empty")
|
|
94
|
+
|
|
95
|
+
if [ -z "$version_badge_id" ] || [ "$version_badge_id" = "null" ]; then
|
|
96
|
+
echo "Badge '$badgename' not found, creating new badge..."
|
|
97
|
+
curl -s --request POST \
|
|
98
|
+
--header "$AUTH_HEADER" \
|
|
99
|
+
--data "name=${badgename}" \
|
|
100
|
+
--data "link_url=https://gitlab.com/${CI_PROJECT_PATH}" \
|
|
101
|
+
--data "image_url=https://img.shields.io/badge/${badgename}-${APP_VERSION}-blue" \
|
|
102
|
+
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/badges"
|
|
103
|
+
else
|
|
104
|
+
echo "Updating badge ID: $version_badge_id"
|
|
105
|
+
curl -s --request PUT \
|
|
106
|
+
--header "$AUTH_HEADER" \
|
|
107
|
+
--data "image_url=https://img.shields.io/badge/${badgename}-${APP_VERSION}-blue" \
|
|
108
|
+
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/badges/${version_badge_id}"
|
|
109
|
+
fi
|
|
110
|
+
rules:
|
|
111
|
+
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?(-\S*)?$/'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 pyPhases
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyPhasesRecordloaderAlice
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Adds a record loaders to the pyPhases package
|
|
5
|
+
Home-page: https://gitlab.com/tud.ibmt.public/pyphases/pyphasesrecordloader/
|
|
6
|
+
Author: Franz Ehrlich
|
|
7
|
+
Author-email: fehrlichd@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.5
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: pyPhases
|
|
15
|
+
Requires-Dist: pyPhasesRecordloader
|
|
16
|
+
Requires-Dist: pyedflib
|
|
17
|
+
Requires-Dist: SleepHarmonizer
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
Dynamic: requires-dist
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# Extension for pyPhasesRecordloader
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
In a phase you can access the data through the `RecordLoader`:
|
|
36
|
+
|
|
37
|
+
Add the plugins and config values to your project.yaml::
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
name: AliceProject
|
|
41
|
+
plugins:
|
|
42
|
+
- pyPhasesML
|
|
43
|
+
- pyPhasesRecordloaderAlice
|
|
44
|
+
- pyPhasesRecordloader
|
|
45
|
+
|
|
46
|
+
phases:
|
|
47
|
+
- name: MyPhase
|
|
48
|
+
|
|
49
|
+
config:
|
|
50
|
+
alice-path: C:/datasets/recordings
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
In a phase (`phases/MyPhase.py`) you can access the records using the `RecordLoader`:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from pyPhasesRecordloader import RecordLoader
|
|
58
|
+
from pyPhases import Phase
|
|
59
|
+
|
|
60
|
+
class MyPhase(Phase):
|
|
61
|
+
def run(self):
|
|
62
|
+
recordIds = recordLoader.getRecordList()
|
|
63
|
+
for recordId in recordIds:
|
|
64
|
+
record = recordLoader.getRecord(recordId)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Run your project with `python -m phases run MyPhase`.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Extension for pyPhasesRecordloader
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
In a phase you can access the data through the `RecordLoader`:
|
|
8
|
+
|
|
9
|
+
Add the plugins and config values to your project.yaml::
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
name: AliceProject
|
|
13
|
+
plugins:
|
|
14
|
+
- pyPhasesML
|
|
15
|
+
- pyPhasesRecordloaderAlice
|
|
16
|
+
- pyPhasesRecordloader
|
|
17
|
+
|
|
18
|
+
phases:
|
|
19
|
+
- name: MyPhase
|
|
20
|
+
|
|
21
|
+
config:
|
|
22
|
+
alice-path: C:/datasets/recordings
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
In a phase (`phases/MyPhase.py`) you can access the records using the `RecordLoader`:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from pyPhasesRecordloader import RecordLoader
|
|
30
|
+
from pyPhases import Phase
|
|
31
|
+
|
|
32
|
+
class MyPhase(Phase):
|
|
33
|
+
def run(self):
|
|
34
|
+
recordIds = recordLoader.getRecordList()
|
|
35
|
+
for recordId in recordIds:
|
|
36
|
+
record = recordLoader.getRecord(recordId)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Run your project with `python -m phases run MyPhase`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from pyPhases import PluginAdapter
|
|
2
|
+
from pyPhasesRecordloader import RecordLoader
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Plugin(PluginAdapter):
|
|
6
|
+
def initPlugin(self):
|
|
7
|
+
# self.project.loadConfig(self.project.loadConfig(pathlib.Path(__file__).parent.absolute().joinpath("config.yaml")))
|
|
8
|
+
module = "pyPhasesRecordloaderAlice"
|
|
9
|
+
rlPath = f"{module}.recordLoaders"
|
|
10
|
+
RecordLoader.registerRecordLoader("RecordLoaderAlice", rlPath)
|
|
11
|
+
RecordLoader.registerRecordLoader("AliceRMLLoader", rlPath)
|
|
12
|
+
alicePath = self.getConfig("alice-path")
|
|
13
|
+
self.project.setConfig("loader.alice.filePath", alicePath)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
loader:
|
|
2
|
+
alice:
|
|
3
|
+
dataBase: Alice
|
|
4
|
+
dataBaseVersion: 1.0.0 # needs to be raised every time new data is added
|
|
5
|
+
|
|
6
|
+
filePath: ./datasets/recordings
|
|
7
|
+
dataIsFinal: False # more recordings will be stored in the futur
|
|
8
|
+
|
|
9
|
+
dataset:
|
|
10
|
+
loaderName: RecordLoaderAlice
|
|
11
|
+
dataHandler:
|
|
12
|
+
type: folders
|
|
13
|
+
listFilter: acq
|
|
14
|
+
canReadRemote: True
|
|
15
|
+
basePath: .
|
|
16
|
+
extensions: [.edf, .rml, .txt]
|
|
17
|
+
force: False
|
|
18
|
+
idPattern: .*/(.*[^-T]).edf
|
|
19
|
+
signal-path: "{recordId}/{recordId}.edf"
|
|
20
|
+
annotation-path: "{recordId}/{recordId}.rml"
|
|
21
|
+
metadata-path: "{recordId}/{recordId}.txt"
|
|
22
|
+
|
|
23
|
+
# the channels that should be extracted from the edf files
|
|
24
|
+
sourceChannels:
|
|
25
|
+
- name: EEG F3-A2
|
|
26
|
+
type: eeg
|
|
27
|
+
- name: EEG F4-A1
|
|
28
|
+
type: eeg
|
|
29
|
+
- name: EEG C3-A2
|
|
30
|
+
type: eeg
|
|
31
|
+
- name: EEG C4-A1
|
|
32
|
+
type: eeg
|
|
33
|
+
- name: EEG O1-A2
|
|
34
|
+
type: eeg
|
|
35
|
+
- name: EEG O2-A1
|
|
36
|
+
type: eeg
|
|
37
|
+
- name: EEG A1-A2
|
|
38
|
+
type: eeg
|
|
39
|
+
- name: EOG LOC-A2
|
|
40
|
+
type: eog
|
|
41
|
+
- name: EOG ROC-A1
|
|
42
|
+
type: eog
|
|
43
|
+
- name: EMG Chin
|
|
44
|
+
type: emg
|
|
45
|
+
- name: Leg
|
|
46
|
+
generated: True
|
|
47
|
+
type: emg
|
|
48
|
+
- name: Leg 1
|
|
49
|
+
type: emg
|
|
50
|
+
- name: Leg 2
|
|
51
|
+
type: emg
|
|
52
|
+
- name: Body
|
|
53
|
+
type: body
|
|
54
|
+
- name: Snore
|
|
55
|
+
type: mic
|
|
56
|
+
- name: Effort THO
|
|
57
|
+
type: effort
|
|
58
|
+
- name: Effort ABD
|
|
59
|
+
type: effort
|
|
60
|
+
- name: SpO2
|
|
61
|
+
type: sao2
|
|
62
|
+
- name: Flow Aux1
|
|
63
|
+
type: flow
|
|
64
|
+
optional: True
|
|
65
|
+
- name: Flow Aux2
|
|
66
|
+
type: flow
|
|
67
|
+
optional: True
|
|
68
|
+
- name: Flow Aux4
|
|
69
|
+
type: flow
|
|
70
|
+
optional: True
|
|
71
|
+
- name: Flow Aux5
|
|
72
|
+
type: flow
|
|
73
|
+
optional: True
|
|
74
|
+
- name: Flow Patient
|
|
75
|
+
type: flow
|
|
76
|
+
optional: True
|
|
77
|
+
- name: FlowSelect
|
|
78
|
+
generated: True
|
|
79
|
+
aliases: [Flow Aux1, Flow Aux2, Flow Aux4, Flow Aux5, Flow Patient]
|
|
80
|
+
type: flow
|
|
81
|
+
- name: ECG I
|
|
82
|
+
type: ecg
|
|
83
|
+
- name: RR
|
|
84
|
+
type: rr
|
|
85
|
+
- name: Pleth
|
|
86
|
+
type: ppg
|
|
87
|
+
optional: True
|
|
88
|
+
|
|
89
|
+
combineChannels:
|
|
90
|
+
- name: FlowSelect
|
|
91
|
+
combineType: select
|
|
92
|
+
type: flow
|
|
93
|
+
channel: [Flow Aux1, Flow Aux2, Flow Aux4, Flow Aux5, Flow Patient]
|
|
94
|
+
|
|
95
|
+
useLoader: alice
|
|
96
|
+
alice-path: datasets/Alice
|
|
97
|
+
|