Skip to content

Commit

Permalink
Merge pull request #62 from matthiaskoenig/develop
Browse files Browse the repository at this point in the history
pkpd-v0.1.0
  • Loading branch information
matthiaskoenig authored Aug 23, 2018
2 parents f49593a + 38c74ed commit 4776b2b
Show file tree
Hide file tree
Showing 110 changed files with 22,385 additions and 866 deletions.
16 changes: 13 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ __pycache__/
# C extensions
*.so

# open/libre office
*.ods#


# Distribution / packaging
.Python
build/
# build/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -57,7 +61,7 @@ coverage.xml
# Django stuff:
*.log
.static_storage/
.media/
media/
local_settings.py

# Flask stuff:
Expand Down Expand Up @@ -106,6 +110,12 @@ venv.bak/

# django staticfiles
/static
/migrations

*/migrations/
# mypy
.mypy_cache/
pkdb_app/studies/migrations/00*.py
pkdb_app/users/migrations/00*.py
pkdb_app/subjects/migrations/00*.py
pkdb_app/interventions/migrations/00*.py
pkdb_app/comments/migrations/00*.py
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ENV PYTHONUNBUFFERED 1
# Allows docker to cache installed dependencies between builds
COPY ./requirements.txt requirements.txt
RUN pip install -r requirements.txt
#ENV DJANGO_SETTINGS_MODULE pkdb_app.config.local


# Adds our application code to the image
COPY . code
Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Database and web interface for storing pharmacokinetics information including
<img src="./docs/images/data_extraction.png" width="600"/>
Figure 1: Overview over data extraction.

## Access
http://localhost:8000/api/v1/
http://localhost:8000/api/v1/studies/17955229/




## Data model
Pharmacokinetics data is a special type of experimental data.
Pharmacokinetics data like clearance, halflife, ... (with units and error measurements) are either directly reported in publications
Expand Down Expand Up @@ -51,6 +58,32 @@ Create a superuser to login to the admin:
docker-compose run --rm web ./manage.py createsuperuser
```

# Update after code change
```
# reset migrations
sudo find . -path "*/migrations/*.py" -not -name "__init__.py" -delete && sudo find . -path "*/migrations/*.pyc" -delete && sudo rm -r media/study/
# rebuild container
docker-compose down
docker-compose up --build
```


# Fill database
From console use the following
```
workon pkdb
(pkdb) pip install -r requirements.txt --upgrade
(pkdb) python ./pkdb_app/data_management/fill_database.py
```


# Connect database pycharm
```
DataSource -> postgres
```
Use port defined in `docker-compose.yml` (5433), database name and password in `docker-compose.yml`

# Local Development
Start the dev server for local development:

Expand All @@ -69,5 +102,14 @@ Example:
```

----
# Client
check out ./client/README.md.
## Requirements
- node.js
- npm
- vue.js




&copy; 2018 Jan Grzegorzewski & Matthias König.
94 changes: 93 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
# Small Tasks
- change how to write characteristicy ("choice": "Y(3)||N(1)")

- move reused information on groupset and interventionset, e.g.,
characteristica which are for all groups ✅
- remove description from group & intervention ✅

- add comments on group and intervention, groupset and intervention (serializer and data model)
- use usernames for name (shorter and faster) ✅
- remove NA from errors ✅
- add substances on study (from categorials list of substances) ✅
- update names changed in categorials ✅
- add value field on valuable ✅, make sure means are stored as mean (i.e. values from a group with more than 1 subject)

- remove choice from valuable ✅

- add design to studies ✅

- API endpoints
- reference
- study (complete JSON)
- groupset ()
- group
- characteristica
- individualset
- interventionset
- intervention
- outputset
- output
- Documentation API (Swagger DRF/Open API)
(- show required fields & choices of choice fields if possible, test description for fields)

- Group Timecourse with column selection based on Akinyinka2000_Fig1 & Akinyinka2000_Fig2

- individualset similar to groupset (with characteristica on individualset for all individuals)
- first step list individual individually (no column mapping for now)

- LATER: create list of allowed keywords and choices (for now looked up in categorials)

#Questions Janek:
- do we need description on study? For now it is in.

# Main Tasks

* import existing data sets (caffeine & acetaminophen)
* web interface for display
* export to excel files and CSVs
* web interface for curation
Expand All @@ -10,3 +51,54 @@ Have a look at genetic variants

https://www.pharmvar.org/
https://www.pharmvar.org/gene/CYP1A1

## timescource example
```json
{
"timecourse": [
{
"group": "col==subjects",
"intervention": "D1",
"source": "Akinyinka2000_Fig1.csv",
"format": "TSV",
"figure": "Akinyinka2000_Fig1.png",
"substance": "caffeine",
"tissue": "plasma",
"pktype": "concentration",
"times": "col==time",
"values": "col==caf",
"sd": "col==caf_sd",
"unit": "µg/ml"
},
{
"group": "col==subjects",
"intervention": "D1",
"source": "Akinyinka2000_Fig1.csv",
"format": "TSV",
"figure": "Akinyinka2000_Fig2.png",
"substance": "paraxanthine",
"tissue": "plasma",
"pktype": "concentration",
"times": "col==time",
"values": "col==px",
"sd": "col==px_sd",
"unit": "µg/ml"
},
{
"group": "col==subjects",
"intervention": "D1",
"source": "Akinyinka2000_Fig1.csv",
"format": "TSV",
"figure": "Akinyinka2000_Fig1.png && Akinyinka2000_Fig2.png",
"substance": "paraxanthine && caffeine",
"tissue": "plasma",
"pktype": "ratio",
"times": "col==time",
"values": "col==px_caf",
"sd": "col==px_caf_sd",
"unit": "-"
}
]
}
```

18 changes: 18 additions & 0 deletions client/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}
9 changes: 9 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
5 changes: 5 additions & 0 deletions client/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/build/
/config/
/dist/
/*.js
/test/unit/coverage/
29 changes: 29 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// https://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
],
// required to lint *.vue files
plugins: [
'vue'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
17 changes: 17 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/test/unit/coverage/
/test/e2e/reports/
selenium-debug.log

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
10 changes: 10 additions & 0 deletions client/.postcssrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
35 changes: 35 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frontend

> pkdb
## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

# run unit tests
npm run unit

# run e2e tests
npm run e2e

# run all tests
npm test
```

For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).


```
sudo apt-get install npm
```
41 changes: 41 additions & 0 deletions client/build/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict'
require('./check-versions')()

process.env.NODE_ENV = 'production'

const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')

const spinner = ora('building for production...')
spinner.start()

rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')

if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}

console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})
Loading

0 comments on commit 4776b2b

Please sign in to comment.