Skip to content

Commit b78e02e

Browse files
committed
Merge remote-tracking branch 'origin/main' into 127-implement-mims
2 parents c08fc68 + 8ae0163 commit b78e02e

5 files changed

Lines changed: 138 additions & 13 deletions

File tree

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
docs/
2+
tests/sample_data
3+
*.png
4+
*.csv
5+
*.xlsx
6+
*.md
7+
!README.md

.github/workflows/release.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
push_to_registry:
16+
name: Push Docker image to Docker Hub
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out the repo
20+
uses: actions/checkout@v4
21+
with:
22+
lfs: true
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
29+
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
32+
with:
33+
username: ${{ secrets.DOCKER_USERNAME }}
34+
password: ${{ secrets.DOCKER_PASSWORD }}
35+
36+
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
40+
with:
41+
images: cmidair/wristpy
42+
43+
44+
- name: Build and push Docker image
45+
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0
46+
with:
47+
platforms: linux/amd64,linux/arm64
48+
context: .
49+
file: ./Dockerfile
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ pip install wristpy
5050

5151
## Quick start
5252

53+
`wristpy` provides three flexible interfaces: a command-line tool for direct execution, an importable Python library, and a Docker image for containerized deployment.
54+
5355
### Using Wristpy through the command-line:
5456
#### Run single files:
5557
```sh
@@ -117,6 +119,49 @@ nonwear_array = subject1.nonwear_epoch
117119
sleep_windows = subject1.sleep_windows_epoch
118120
```
119121

122+
### Using Wristpy Through Docker
123+
124+
125+
1. **Install Docker**: Ensure you have Docker installed on your system. [Get Docker](https://docs.docker.com/get-docker/)
126+
127+
2. **Pull the Docker image**:
128+
```bash
129+
docker pull cmidair/wristpy:main
130+
```
131+
132+
3. **Run the Docker image** with your data:
133+
```bash
134+
docker run -it --rm \
135+
-v "/local/path/to/data:/data" \
136+
-v "/local/path/to/output:/output" \
137+
cmidair/wristpy
138+
```
139+
Replace `/local/path/to/data` with the path to your input data directory and `/local/path/to/output` with where you want results saved.
140+
141+
To run a single file, we simply need to modify the mounting structure for the docker call slightly:
142+
```bash
143+
docker run -it --rm \
144+
-v "/local/path/to/data/file.bin:/data/file.bin" \
145+
-v "/local/path/to/output:/output" \
146+
cmidair/wristpy
147+
```
148+
149+
### Customizing the Pipeline:
150+
151+
The Docker image supports multiple input variables to customize processing. You can set these by simply chaining these inputs as you would for the CLI input:
152+
153+
```bash
154+
docker run -it --rm \
155+
-v "/local/path/to/data/file.bin:/data/file.bin" \
156+
-v "/local/path/to/output:/output" \
157+
cmidair/wristpy /data --output /output --epoch-length 5 --nonwear-algorithm ggir --nonwear-algorithm detach --thresholds 0.1 0.2 0.4
158+
```
159+
160+
161+
162+
For more details on available options, see the [orchestrator documentation](https://childmindresearch.github.io/wristpy/wristpy/core/orchestrator.html#run).
163+
164+
120165
## References
121166
1. van Hees, V.T., Sabia, S., Jones, S.E. et al. Estimating sleep parameters
122167
using an accelerometer without sleep diary. Sci Rep 8, 12975 (2018).

dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM python:3.11-buster
2+
3+
WORKDIR /app
4+
COPY . /app/
5+
6+
RUN apt-get update && apt-get install -y \
7+
build-essential \
8+
gfortran \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
RUN pip install poetry && \
12+
poetry config virtualenvs.create false && \
13+
poetry install --only main
14+
15+
RUN mkdir -p /data /output
16+
17+
ENTRYPOINT ["poetry", "run", "wristpy"]
18+
19+
CMD ["/data", "--output", "/output", "--output-filetype", ".csv", "--calibrator", "none", \
20+
"--activity-metric", "enmo", "--epoch-length", "5", "--nonwear-algorithm", "ggir"]

poetry.lock

Lines changed: 14 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)