Skip to content

Commit

Permalink
docker compose rebuild, import lms search to global_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourpeas committed Dec 28, 2024
1 parent 214b738 commit b2953f7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
FROM python:3.12-bookworm
FROM python:3.12

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

RUN pip install -r requirements.txt
# Create a virtual environment
RUN python -m venv /app/venv

# Upgrade pip and install the dependencies in the virtual environment
RUN /app/venv/bin/pip install --upgrade pip
RUN /app/venv/bin/pip install -r requirements.txt

# Copy the rest of the application code
COPY . .

# Set the entrypoint to use the virtual environment's Python interpreter
CMD ["python3"]
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# NOTE The below is the Docker Compose specification version NOT the Python version:
version: "3.12"

services:
Expand All @@ -9,5 +8,4 @@ services:
working_dir: /app
tty: true # Allocate a pseudo-TTY
stdin_open: true # Keep stdin open
command: |
pytest
container_name: rcpchgrowth-python
13 changes: 12 additions & 1 deletion rcpchgrowth/global_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from .trisomy_21 import trisomy_21_lms_array_for_measurement_and_sex
from .cdc import cdc_lms_array_for_measurement_and_sex
from .trisomy_21_aap import trisomy_21_aap_lms_array_for_measurement_and_sex
from .who import who_lms_array_for_measurement_and_sex

# from scipy import interpolate #see below, comment back in if swapping interpolation method
# from scipy.interpolate import CubicSpline #see below, comment back in if swapping interpolation method
from .constants.reference_constants import MALE, UK_WHO, TURNERS, TRISOMY_21, BMI, CDC, TRISOMY_21_AAP, HEAD_CIRCUMFERENCE
from .constants.reference_constants import UK_WHO, TURNERS, TRISOMY_21, BMI, CDC, TRISOMY_21_AAP, WHO


"""Public functions"""
Expand Down Expand Up @@ -585,6 +586,16 @@ def lms_value_array_for_measurement_for_reference(
)
except LookupError as error:
raise LookupError(error)
elif reference == WHO:
try:
lms_value_array_for_measurement = who_lms_array_for_measurement_and_sex(
age=age,
measurement_method=measurement_method,
sex=sex,
default_youngest_reference=default_youngest_reference,
)
except LookupError as error:
raise LookupError(error)
elif reference == TURNERS:
try:
lms_value_array_for_measurement = turner_lms_array_for_measurement_and_sex(
Expand Down
10 changes: 10 additions & 0 deletions s/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -v # Enable verbose mode
set -e # Exit on error

# scripts may need to be made executable on some platforms before they can be run
# chmod +x <filename> is the command to do this on unixy systems

# starts all docker compose services
docker-compose build

0 comments on commit b2953f7

Please sign in to comment.