Skip to content

Commit

Permalink
Merge latest into main
Browse files Browse the repository at this point in the history
* Init commit to bring datastore demo report into this repo as a base.

* Update to functional version

* Authentication: pass required info to datastore

* updates

* Getting things hooked back up.

* Update deprecated pd.append to concat

* Move summary rollup formatting to own function to fix downstream dependencies

* Datastore version of report (works locally)

* Exlude early withdrawal subjects

* Update ReadME

* Updated to get excel download working. Rename docker container

* Debugginb api_json loading issues at TACC (works locally)

* Add remaining tables to excel export

---------

Co-authored-by: Frank Netscher <[email protected]>
Co-authored-by: Chandra Y <[email protected]>
  • Loading branch information
3 people authored Sep 14, 2023
1 parent 59435ed commit 9684e8e
Show file tree
Hide file tree
Showing 15 changed files with 840 additions and 143 deletions.
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Local files for development purposes
data/
.env
src/data/

# Byte-compiled / optimized / DLL files
__pycache__/

# Local data archives
datastore/src/data/archive/
datastore_client/src/archive/
testit.py
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
Expand Down Expand Up @@ -154,4 +156,6 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.

#.idea/

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim
FROM python:3.10

ENV PYTHONUNBUFFERED=TRUE

Expand Down
77 changes: 19 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,24 @@
# Generic Template Reporting for the A2CPS program
Docker container of Dash App to display A2CPS trial Generic Template reporting metrics.
# Monthly Enrollment report
Report to plot monthly enrollments by site and surgery


## Version History
| Version | Date | Description |
| ------ | ------ | ------ |
| 0.0.1 | date | Status |


# Development Previews

Development previews are built upon commits to the master branch. If you wish to preview the latest
build, you may use the `docker-compose.yml` file. On your local machine with Docker, run:

```
docker-compose up --force-recreate
```

Then browse to `localhost:8050` in your web browser.

# Automatic Container Build information from parent repository.
This repository was forked from the TACC [dash-container](https://github.com/TACC/dash-container) repo.

## Configuring your repository for automatic container builds (text from original repo)

### Github Actions workflows

This repository comes with two Github Action workflows that automatically build Docker containers:

- [build-pr](./github/workflows/build-pr) builds commit sha tagged
images upon pull requests
- [build-main](./github/workflows/build-main) builds a commit sha tagged and `:latest` tagged image upon
pushes to main (such as when merging a pull request)

Both require specific Github repo configuration.

### Setting up a Dockerhub token

You will need to create a token for the account that will be used to push your repo.

- On [Dockerhub](https://hub.docker.com) go to your account's [security settings](https://hub.docker.com/settings/security).
- Click the **New Access Token** button and type in a description
- You will see a UUID value - this is your access token. Copy it immediately, as these can only
be read upon creation. You will not see this token again.

### Setting up a Github Actions environment

You will need to create a build environment with secrets to contain Dockerhub settings.

- In your Github repo, click on **Settings**. Then click on **Environments**
- Click on the **New Environment** button and name this environment `docker`. (You can change the
`environment` value in the workflows if you wish to call it something else or keep multiple environments)
- At the bottom of the screen you will see **Environment Secrets**. Click the **Add Secret** button to create secrets.
- Create a secret called `DOCKERHUB_TOKEN` and paste your Dockerhub token here
- Create a secret called `DOCKERHUB_USERNAME` and put the name of the corresponding user here
- Create a secret called `DOCKERHUB_REPO` and put your Docker repository name here. For example, this Github repo
autobuilds images at `jchuahtacc/dash-container`, so that is the value that is used for `DOCKERHUB_REPO`.

### Test it out

Upon pull requests and pushes to main, you will see the workflows perform autobuilds. You can
view the Action results by going to the **Actions** tag of your repo. You can also go to your [Dockerhub](https://hub.docker.com) page and make sure images are properly getting tagged and pushed
| 0.0.1 | 2022 | Original verion |
| 0.0.2 | 9/12/2023 | Conversion to Datastore model |


## Data Transformation Description
1. Report uses the data api for consented subjects
2. 'Enrolled' subjects are defined as all consented subjects who have not withdrawn early from the program
3. Records for each site and surgery are rolled up on a monthly basis based on the orginal consent date
4. Actual enrollments are compared to expected enrollments that are defined according to the following table

### Enrollment Expectations
| MCC | Surgery | Start | Expected at Start | Additional Monthly |
| ------ | ------ | ------ | ------ | ------ |
| 1 | TKA | 2/22 | 280 | 30 |
| 1 | Thoracic | 6/22 | 10 | 10 |
| 2 | Thoracic | 2/22 | 70 | 30 |
| 2 | TKA | 6/22 | 10 | 10 |
24 changes: 20 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@
---
version: "3"
services:
a2cps_report_template__dash:
image: wmatacc/a2cpsi-report-template-dash:latest
datastore_enrollment:
build: .
ports:
- 8050:8050
container_name: a2cps_report_template_dash
- 8890:8050
dns:
- 8.8.8.8
- 8.8.4.4
stdin_open: true
tty: true
command: ["gunicorn", "--reload", "-b :8050", "-t 90", "app:server"]
container_name: datastore_enrollment
hostname: datastore_enrollment
volumes:
- ./src:/app
env_file:
- ./.env

networks:
default:
name: a2cps_datastore_net
external: true
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
dash==2.0.0
dash-bootstrap-components==1.0.0rc1
dash==2.5.1
dash-bootstrap-components==1.1.0
dash-daq==0.5.0
dash-extensions==0.0.55
Flask==2.1.0
dash-extensions==0.0.71
Flask==2.1.2
gunicorn==20.0.4
pandas==1.3.4
plotly==5.3.1
numpy==1.20.1
pandas==1.3.5
plotly==5.9.0
numpy==1.21.6
requests
xlsxwriter==1.4.3
xlsxwriter==3.0.3
Werkzeug==2.0.3
Empty file added src/__init__.py
Empty file.
Loading

0 comments on commit 9684e8e

Please sign in to comment.