Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/django-3.2.19
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins authored Nov 20, 2023
2 parents 2b21cb8 + a8eb89b commit 9c5042e
Show file tree
Hide file tree
Showing 214 changed files with 29,495 additions and 8,650 deletions.
27 changes: 1 addition & 26 deletions .env
Original file line number Diff line number Diff line change
@@ -1,26 +1 @@
PORT=8020
DEBUG=1
HOST_NAME=monkshood
SECRET_KEY=aLargeRandomSecretKey
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_PASSWORD=sekret1
DJANGO_SUPERUSER_EMAIL=[email protected]
EMAIL_HOST=in-v3.mailjet.com
EMAIL_PORT=25
EMAIL_HOST_USER=email_username
EMAIL_HOST_PASSWORD=email_password
DEFAULT_FROM_EMAIL=[email protected]
POSTGRES_PASSWORD=sekret2
DATABASE_URL=postgres://postgres:sekret2@postgres:5432/postgres

RABBITMQ_DEFAULT_USER=guest
RABBITMQ_DEFAULT_PASS=guest

AUTH_LDAP_USE=0
AUTH_LDAP_SERVER_URI=ldap://ldap.forumsys.com:389
AUTH_LDAP_DIRECT_BIND=1
AUTH_LDAP_BIND_DN_TEMPLATE=uid=%(user)s,dc=example,dc=com
AUTH_LDAP_BIND_DN=cn=read-only-admin,dc=example,dc=com
AUTH_LDAP_BIND_PASSWORD=password
AUTH_LDAP_SEARCH_BASE=ou=mathematicians,dc=example,dc=com
AUTH_LDAP_SEARCH_FILTER=(uid=%(user)s)
DEBUG=1
26 changes: 26 additions & 0 deletions .env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PORT=8020
DEBUG=1
HOST_NAME=monkshood
SECRET_KEY=aLargeRandomSecretKey
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_PASSWORD=sekret1
DJANGO_SUPERUSER_EMAIL=[email protected]
EMAIL_HOST=in-v3.mailjet.com
EMAIL_PORT=25
EMAIL_HOST_USER=email_username
EMAIL_HOST_PASSWORD=email_password
DEFAULT_FROM_EMAIL=[email protected]
POSTGRES_PASSWORD=sekret2
DATABASE_URL=postgres://postgres:sekret2@postgres:5432/postgres

RABBITMQ_DEFAULT_USER=guest
RABBITMQ_DEFAULT_PASS=guest

AUTH_LDAP_USE=0
AUTH_LDAP_SERVER_URI=ldap://ldap.forumsys.com:389
AUTH_LDAP_DIRECT_BIND=1
AUTH_LDAP_BIND_DN_TEMPLATE=uid=%(user)s,dc=example,dc=com
AUTH_LDAP_BIND_DN=cn=read-only-admin,dc=example,dc=com
AUTH_LDAP_BIND_PASSWORD=password
AUTH_LDAP_SEARCH_BASE=ou=mathematicians,dc=example,dc=com
AUTH_LDAP_SEARCH_FILTER=(uid=%(user)s)
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[flake8]
max-line-length = 88
extend-ignore = E203, W503

exclude=
.git,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/copyright-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: '3.10'
architecture: x64

- name: install ldap
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: '3.10'
architecture: x64

- name: install sundials
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/style-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: '3.10'
architecture: x64

- name: install ldap
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-test-os-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v1

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: '3.10'
architecture: x64

- name: install sundials (ubuntu)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test-python-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, "3.10"]
python-version: ['3.10']

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ pkpdapp/static

# nodemodules
frontend/node_modules

logfile.log*
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Using a 2-stage build. This is the builder for javascript frontend

FROM node:lts as build
FROM node:19 as build
RUN mkdir -p /app/frontend
WORKDIR /app/frontend
COPY frontend/package.json /app/frontend
COPY frontend-v2/package.json /app/frontend

RUN npm install --legacy-peer-deps
RUN npm install

COPY frontend /app/frontend/
COPY frontend-v2 /app/frontend/
RUN npm run build

FROM python:3.9
FROM python:3.10

# install libsundials-dev
RUN apt-get update && apt-get upgrade -y
Expand All @@ -34,7 +34,7 @@ RUN rm -rf /var/lib/apt/lists/*
# install dependencies
COPY ./requirements.txt /
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y build-essential libsasl2-dev python-dev libldap2-dev libssl-dev
RUN apt-get install -y build-essential libsasl2-dev python3-dev libldap2-dev libssl-dev

RUN pip install -r requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ described using the OpenAPI specification. To generate the OpenAPI
specification, run the following command:
```bash
python manage.py generateschema --file schema.yml
python manage.py spectacular --color --file schema.yml
```
## Generating RTX Query API class
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ services:
ports:
- "5432:5432"
env_file:
- ./.env
- ./.env.prod
restart: unless-stopped
volumes:
- db:/var/lib/postgresql/data
rabbitmq:
image: rabbitmq:3-management-alpine
env_file:
- ./.env
- ./.env.prod
ports:
- 5672:5672
- 15672:15672
Expand All @@ -33,6 +33,6 @@ services:
- "80:${PORT}"
restart: unless-stopped
env_file:
- ./.env
- ./.env.prod


18 changes: 18 additions & 0 deletions frontend-v2/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:3000',

},

component: {
devServer: {
framework: "next",
bundler: "webpack",
},
},
});
2 changes: 2 additions & 0 deletions frontend-v2/cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.png
*.mp4
101 changes: 101 additions & 0 deletions frontend-v2/cypress/e2e/pkmodel.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
describe('landing page', () => {
beforeEach(() => {
const { username, password } = { username: 'demo', password: '12345'}
cy.login(username, password)
})

it('can create combined pk and pd model and simulate from it', () => {
// create a new project
cy.intercept('POST', '/api/project/').as('createProject')
cy.get('[data-cy="create-project"]').click()
cy.get('[data-cy="create-project-option-Small Molecule"]').click()
cy.wait('@createProject').then((interception) => {
const { id } = interception.response.body

// select the species
cy.get(`[data-cy="project-${id}"]`).find('[data-cy="select-project.species"]').click()
cy.get('[data-cy="select-option-project.species-Monkey"]').click()

// select the project
cy.get(`[data-cy="project-${id}"]`).find('[type=radio]').click()
});

cy.get('[data-cy="select-project.species"]').last().click()
cy.get('[data-cy="select-option-project.species-Monkey"]').last().click()


// go to model tab
cy.get('li').contains('Model').click()

// select one compartment model
cy.get('[data-cy="select-pk_model"]').click()
cy.get('[data-cy="select-option-pk_model-one_compartment_preclinical"]').click()

// select pd model
cy.get('[data-cy="select-pd_model"]').click()
cy.get('[data-cy="select-option-pd_model-indirect_effects_stimulation_elimination"]').click()

// go to map variables tab
cy.contains('button', 'Map Variables').click()

// dose into Aa compartment
cy.get('[data-cy="checkbox-dosing-Aa"]').click()

// map C1 to pd effect
cy.get('[data-cy="checkbox-map-to-pd-C1"]').click()

// go to parameters tab
cy.contains('button', 'Parameters').click()

cy.get('[data-cy="parameter-CL-value"]').find('input').then(($input) => {
const old_value = $input.val()

// reset to species defaults
cy.contains('button', 'Reset to Species Defaults').click()
cy.wait(1000)

// check that the value has changed
cy.get('[data-cy="parameter-CL-value"]').find('input').then(($input) => {
expect($input.val()).not.to.eq(old_value)
})
});

// go to trial design tab
cy.get('li').contains('Trial Design').click()

// set the dose
cy.get('input[name="doses.0.amount"]').clear().type('1')

// set the number of doses
cy.get('input[name="doses.0.repeats"]').clear().type('4')

// set the duration
cy.get('input[name="doses.0.duration"]').clear().type('0.1')

// set the interval
cy.get('input[name="doses.0.repeat_interval"]').clear().type('0.1')

// go to simulation tab
cy.get('li').contains('Simulations').click()

// should be no svg with class "main-svg"
cy.get('svg.main-svg').should('not.exist')

// add a plot of Aa
cy.get('[data-cy="add-plot"]').click()
cy.get('[data-cy^="add-plot-option-Aa"]').click()

// now there should be an svg with class "main-svg"
cy.get('svg.main-svg').should('exist')

// should be no CL slider
cy.get('[data-cy="parameter-slider-CL"]').should('not.exist')

// add a CL parameter slider
cy.get('[data-cy="add-parameter-slider"]').click()
cy.get('[data-cy="add-parameter-slider-option-CL"]').click()

// CL slider should exist
cy.get('[data-cy="parameter-slider-CL"]').should('exist')
});
});
55 changes: 55 additions & 0 deletions frontend-v2/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

Cypress.Commands.add('login', (username, password) => {
cy.visit('/')

cy.get('input[name=username]').type(username)

// {enter} causes the form to submit
cy.get('input[name=password]').type(`${password}{enter}`, { log: false })

// we should be redirected to /
cy.url().should('not.contain', 'login')

// our auth cookies should be present
cy.getCookie('csrftoken').should('exist')
cy.getCookie('sessionid').should('exist')
})

export {}
Loading

0 comments on commit 9c5042e

Please sign in to comment.