Skip to content

Commit 17bc0ca

Browse files
authored
Merge pull request #2 from nlpsandbox/prepare-repository
Prepare repository
2 parents be28c20 + 84484e9 commit 17bc0ca

File tree

11 files changed

+225
-737
lines changed

11 files changed

+225
-737
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ HOST_PORT=80
1313

1414
# User-specified settings made visible to RStudio (APP_*)
1515
APP_NLPSANDBOX_SCHEMAS_VERSION=1.2.0
16-
APP_DATASET_VERSION=1.2.1

.github/workflows/ci.yml

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99
pull_request:
1010

1111
env:
12-
docker_repository: docker.synapse.org/syn22277123/i2b2-phi-dataset
12+
docker_repository: nlpsandbox/nlpsandbox-analysis
1313
# github.event.repository.clone_url not available for on: schedule
14-
clone_url: https://github.com/nlpsandbox/i2b2-phi-dataset.git
14+
clone_url: https://github.com/nlpsandbox/nlpsandbox-analysis.git
1515
# github.event.repository.default_branch not available for on: schedule
1616
default_branch: main
1717

@@ -80,7 +80,7 @@ jobs:
8080
args: Dockerfile
8181
- name: Check that packages in requirements.txt files are in asc order
8282
run: |
83-
sort -f --check conda/i2b2-phi-dataset/requirements.txt
83+
sort -f --check conda/nlpsandbox/requirements.txt
8484
8585
test:
8686
needs: [lint]
@@ -124,12 +124,12 @@ jobs:
124124
restore-keys: |
125125
${{ runner.os }}-single-buildx
126126
127-
- name: Login to Docker Hub
128-
uses: docker/login-action@v1
129-
with:
130-
registry: docker.synapse.org
131-
username: ${{ secrets.SYNAPSE_USERNAME }}
132-
password: ${{ secrets.SYNAPSE_TOKEN }}
127+
# - name: Login to Docker Hub
128+
# uses: docker/login-action@v1
129+
# with:
130+
# registry: docker.synapse.org
131+
# username: ${{ secrets.SYNAPSE_USERNAME }}
132+
# password: ${{ secrets.SYNAPSE_TOKEN }}
133133

134134
- name: Build image
135135
uses: docker/build-push-action@v2
@@ -151,78 +151,78 @@ jobs:
151151
"GROUPID=$(id -g)" \
152152
"SYNAPSE_TOKEN=${{ secrets.SYNAPSE_TOKEN }}" | tee -a .env >/dev/null
153153
154-
- name: Generate HTML notebooks
155-
run: |
156-
docker run --rm \
157-
--env-file .env \
158-
-v $(pwd):/project \
159-
rstudio-cached:latest \
160-
render /project/notebooks/*.Rmd
161-
162-
- name: Push image
163-
if: env.push_image == 'true'
164-
id: docker_push
165-
uses: docker/build-push-action@v2
166-
with:
167-
registry: docker.synapse.org
168-
context: .
169-
file: Dockerfile
170-
builder: ${{ steps.buildx.outputs.name }}
171-
push: true
172-
platforms: linux/amd64
173-
tags: ${{ env.tags }}
174-
labels: |
175-
org.opencontainers.image.created=${{ env.created }}
176-
org.opencontainers.image.source=${{ github.repositoryUrl }}
177-
org.opencontainers.image.version=${{ env.version }}
178-
org.opencontainers.image.revision=${{ github.sha }}
179-
org.opencontainers.image.licenses=${{ github.event.repository.license.name }}
180-
181-
- name: Prepare to publish HTML notebooks to GH Pages
182-
if: env.push_notebooks == 'true'
183-
run: |
184-
git clone ${{ env.clone_url }} \
185-
--branch gh-pages --single-branch gh-pages
186-
187-
# Update gh-pages: version specified
188-
NOTEBOOKS_TARGET_DIR=gh-pages/${{ env.version }}/notebooks
189-
rm -fr ${NOTEBOOKS_TARGET_DIR}
190-
mkdir -p ${NOTEBOOKS_TARGET_DIR}
191-
cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
192-
193-
# Update gh-pages: latest, major, and minor versions
194-
if [ ! -z "${{ env.version_major }}" ]; then
195-
# Update latest (e.g. "1.2.3" => "latest")
196-
NOTEBOOKS_TARGET_DIR=gh-pages/latest/notebooks
197-
rm -fr ${NOTEBOOKS_TARGET_DIR}
198-
mkdir -p ${NOTEBOOKS_TARGET_DIR}
199-
cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
200-
201-
# Update major version (e.g. "1.2.3" => "1")
202-
NOTEBOOKS_TARGET_DIR=gh-pages/${{ env.version_major }}/notebooks
203-
rm -fr ${NOTEBOOKS_TARGET_DIR}
204-
mkdir -p ${NOTEBOOKS_TARGET_DIR}
205-
cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
206-
207-
# Update minor version (e.g. "1.2.3" => "1.2")
208-
NOTEBOOKS_TARGET_DIR=gh-pages/${{ env.version_minor }}/notebooks
209-
rm -fr ${NOTEBOOKS_TARGET_DIR}
210-
mkdir -p ${NOTEBOOKS_TARGET_DIR}
211-
cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
212-
fi
213-
cd gh-pages
214-
git config --local user.email "action@github.com"
215-
git config --local user.name "GitHub Action"
216-
git add .
217-
git commit -m "Update notebooks" -a || true
218-
# The above command will fail if no changes were present, so we ignore
219-
# that.
220-
221-
- name: Push to gh-pages
222-
if: env.push_notebooks == 'true'
223-
uses: ad-m/github-push-action@master
224-
with:
225-
branch: gh-pages
226-
directory: gh-pages
227-
github_token: ${{ secrets.GITHUB_TOKEN }}
228-
force: true
154+
# - name: Generate HTML notebooks
155+
# run: |
156+
# docker run --rm \
157+
# --env-file .env \
158+
# -v $(pwd):/project \
159+
# rstudio-cached:latest \
160+
# render /project/notebooks/*.Rmd
161+
162+
# - name: Push image
163+
# if: env.push_image == 'true'
164+
# id: docker_push
165+
# uses: docker/build-push-action@v2
166+
# with:
167+
# registry: docker.synapse.org
168+
# context: .
169+
# file: Dockerfile
170+
# builder: ${{ steps.buildx.outputs.name }}
171+
# push: true
172+
# platforms: linux/amd64
173+
# tags: ${{ env.tags }}
174+
# labels: |
175+
# org.opencontainers.image.created=${{ env.created }}
176+
# org.opencontainers.image.source=${{ github.repositoryUrl }}
177+
# org.opencontainers.image.version=${{ env.version }}
178+
# org.opencontainers.image.revision=${{ github.sha }}
179+
# org.opencontainers.image.licenses=${{ github.event.repository.license.name }}
180+
181+
# - name: Prepare to publish HTML notebooks to GH Pages
182+
# if: env.push_notebooks == 'true'
183+
# run: |
184+
# git clone ${{ env.clone_url }} \
185+
# --branch gh-pages --single-branch gh-pages
186+
187+
# # Update gh-pages: version specified
188+
# NOTEBOOKS_TARGET_DIR=gh-pages/${{ env.version }}/notebooks
189+
# rm -fr ${NOTEBOOKS_TARGET_DIR}
190+
# mkdir -p ${NOTEBOOKS_TARGET_DIR}
191+
# cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
192+
193+
# # Update gh-pages: latest, major, and minor versions
194+
# if [ ! -z "${{ env.version_major }}" ]; then
195+
# # Update latest (e.g. "1.2.3" => "latest")
196+
# NOTEBOOKS_TARGET_DIR=gh-pages/latest/notebooks
197+
# rm -fr ${NOTEBOOKS_TARGET_DIR}
198+
# mkdir -p ${NOTEBOOKS_TARGET_DIR}
199+
# cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
200+
201+
# # Update major version (e.g. "1.2.3" => "1")
202+
# NOTEBOOKS_TARGET_DIR=gh-pages/${{ env.version_major }}/notebooks
203+
# rm -fr ${NOTEBOOKS_TARGET_DIR}
204+
# mkdir -p ${NOTEBOOKS_TARGET_DIR}
205+
# cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
206+
207+
# # Update minor version (e.g. "1.2.3" => "1.2")
208+
# NOTEBOOKS_TARGET_DIR=gh-pages/${{ env.version_minor }}/notebooks
209+
# rm -fr ${NOTEBOOKS_TARGET_DIR}
210+
# mkdir -p ${NOTEBOOKS_TARGET_DIR}
211+
# cp -R notebooks/*.html ${NOTEBOOKS_TARGET_DIR}
212+
# fi
213+
# cd gh-pages
214+
# git config --local user.email "action@github.com"
215+
# git config --local user.name "GitHub Action"
216+
# git add .
217+
# git commit -m "Update notebooks" -a || true
218+
# # The above command will fail if no changes were present, so we ignore
219+
# # that.
220+
221+
# - name: Push to gh-pages
222+
# if: env.push_notebooks == 'true'
223+
# uses: ad-m/github-push-action@master
224+
# with:
225+
# branch: gh-pages
226+
# directory: gh-pages
227+
# github_token: ${{ secrets.GITHUB_TOKEN }}
228+
# force: true

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
FROM sagebionetworks/rstudio:4.1.0-efb64703
22

33
LABEL maintainer="team@nlpsandbox.io"
4-
LABEL description="Generation of the i2b2 PHI dataset for the NLP Sandbox"
4+
LABEL description="Example notebooks for interacting with the NLP Sandbox API"
55

66
# Create conda environments
77
COPY conda /tmp/conda
88
RUN conda init bash \
9-
&& conda env create -f /tmp/conda/i2b2-phi-dataset/environment.yml \
9+
&& conda env create -f /tmp/conda/nlpsandbox/environment.yml \
1010
&& rm -fr /tmp/conda \
1111
# Fix libssl issue that affects conda env used with reticulate
1212
&& cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 \
13-
/opt/miniconda/envs/i2b2-phi-dataset/lib/libssl.so.1.1 \
13+
/opt/miniconda/envs/nlpsandbox/lib/libssl.so.1.1 \
1414
&& conda activate base || true \
15-
&& echo "conda activate i2b2-phi-dataset" >> ~/.bashrc
15+
&& echo "conda activate nlpsandbox" >> ~/.bashrc
1616

1717
# Install R dependencies
1818
COPY renv.lock /tmp/renv.lock

conda/i2b2-phi-dataset/environment.yml renamed to conda/nlpsandbox/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: i2b2-phi-dataset
1+
name: nlpsandbox
22
channels:
33
- defaults
44
dependencies:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
challengeutils==4.0.1
2+
nlpsandbox-client==4.0.0
23
pandas==1.2.4
34
synapseclient==2.3.1

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ version: "3.8"
22

33
services:
44
rstudio:
5-
image: docker.synapse.org/syn22277123/i2b2-phi-dataset:1.2.1
5+
image: nlpsandbox/nlpsandbox-analysis:edge
66
build:
77
context: .
88
dockerfile: Dockerfile
9-
container_name: i2b2-phi-dataset
9+
container_name: nlpsandbox-analysis
1010
command: rstudio
1111
env_file:
1212
- .env
1313
volumes:
14-
- .:/home/rstudio/i2b2-phi-dataset:rw
14+
- .:/home/rstudio/nlpsandbox:rw
1515
ports:
1616
- "${HOST_PORT}:8787"
File renamed without changes.

notebooks/data-node.Rmd

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "Interacting with an NLP Sandbox Data Node instance"
3+
author: "NLP Sandbox Team"
4+
date: "`r Sys.Date()`"
5+
output:
6+
html_document:
7+
df_print: paged
8+
code_fold: show
9+
toc: yes
10+
toc_float: yes
11+
pdf_document:
12+
toc: yes
13+
---
14+
15+
# Conda environments
16+
17+
List the Conda environments.
18+
19+
```{r}
20+
library(reticulate)
21+
options(reticulate.repl.quiet = TRUE)
22+
23+
conda_list(conda = "auto")
24+
```
25+
26+
Activate the environment `nlpsandbox`.
27+
28+
```{r}
29+
use_condaenv("nlpsandbox", required = TRUE)
30+
```
31+
32+
# Interacting with a Data Node instance
33+
34+
## Getting health status
35+
36+
```{python}
37+
from nlpsandboxclient import client
38+
39+
data_node_host = "http://localhost:8080/api/v1"
40+
41+
datasets = client.list_datasets(host=data_node_host)
42+
43+
for dataset in datasets:
44+
print("Dataset name: " + dataset.name)
45+
```
46+

0 commit comments

Comments
 (0)