Skip to content

Commit

Permalink
Merge branch 'live' into 18-python-version-upgrade-3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourpeas authored Mar 19, 2024
2 parents 48d27f6 + ae3f64f commit 3590aef
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 87 deletions.
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[bumpversion]
current_version = 3.2.0
current_version = 4.0.0
tag = False
commit = True

[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
search = version="{current_version}"
replace = version="{new_version}"
43 changes: 21 additions & 22 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,29 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8.3'
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -r requirements.txt
- name: Run pytest
run: |
pytest
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -r requirements.txt
- name: Run pytest
run: |
pytest
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
4 changes: 2 additions & 2 deletions rcpchgrowth/fictional_child.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# core imports
from datetime import datetime, timedelta
from datetime import date, timedelta
import random
import math

Expand Down Expand Up @@ -47,7 +47,7 @@ def generate_fictional_child_data(
The development of growth references and growth charts, T J Cole, Ann Hum Biol. 2012 Sep; 39(5): 382–394.
Wikipedia: https://en.wikipedia.org/wiki/Philippe_Gu%C3%A9neau_de_Montbeillard
"""
birth_date = datetime(1759, 4, 11) # YYYY m d
birth_date = date(1759, 4, 11) # YYYY m d
observation_date = birth_date + timedelta(days=start_chronological_age*365.25)

# set the counters
Expand Down
4 changes: 2 additions & 2 deletions rcpchgrowth/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,14 @@ def __create_measurement_object(
if corrected_centile_value > 99 or corrected_centile_value < 1:
corrected_centile_value = round(corrected_centile_value, 1)
else:
corrected_centile_value = int(corrected_centile_value)
corrected_centile_value = round(corrected_centile_value, 1)

if chronological_centile_value:
if chronological_centile_value > 99 or chronological_centile_value < 1:
chronological_centile_value = round(
chronological_centile_value, 1)
else:
chronological_centile_value = int(chronological_centile_value)
chronological_centile_value = round(chronological_centile_value, 1)

measurement_calculated_values = {
"corrected_sds": corrected_sds_value,
Expand Down
12 changes: 8 additions & 4 deletions rcpchgrowth/trisomy_21.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import pkg_resources
from importlib import resources
from pathlib import Path
from .constants import *
# from .global_functions import z_score, cubic_interpolation, linear_interpolation, centile, measurement_for_z, nearest_lowest_index, fetch_lms
# import timeit #see below, comment back in if timing functions in this module
Expand All @@ -18,10 +19,13 @@
reference: reference data
"""

#load the reference data
# load the reference data
data_directory = resources.files("rcpchgrowth.data_tables")

TRISOMY_21_DATA = pkg_resources.resource_filename(__name__, "/data_tables/trisomy_21.json")
with open(TRISOMY_21_DATA) as json_file:


data_path = Path(data_directory, "trisomy_21.json")
with open(data_path) as json_file:
TRISOMY_21_DATA = json.load(json_file)
json_file.close()

Expand Down
10 changes: 6 additions & 4 deletions rcpchgrowth/turner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import pkg_resources
from importlib import resources
from pathlib import Path
from .constants import *
# import timeit #see below, comment back in if timing functions in this module

Expand All @@ -17,10 +18,11 @@
reference: reference data
"""

#load the reference data
# load the reference data
data_directory = resources.files("rcpchgrowth.data_tables")

TURNER_DATA = pkg_resources.resource_filename(__name__, "/data_tables/turner.json")
with open(TURNER_DATA) as json_file:
data_path = Path(data_directory, "turner.json")
with open(data_path) as json_file:
TURNER_DATA = json.load(json_file)
json_file.close()

Expand Down
34 changes: 18 additions & 16 deletions rcpchgrowth/uk_who.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

# standard imports
import json
import pkg_resources
from importlib import resources
from pathlib import Path

# rcpch imports
from .constants import *
Expand All @@ -24,34 +25,35 @@
"""

# load the reference data
data_directory = resources.files("rcpchgrowth.data_tables")

UK90_PRETERM_DATA = pkg_resources.resource_filename(
__name__, "/data_tables/uk90_preterm.json") # 23 - 42 weeks gestation
with open(UK90_PRETERM_DATA) as json_file:
data_path = Path(
data_directory, "uk90_preterm.json") # 23 - 42 weeks gestation
with open(data_path) as json_file:
UK90_PRETERM_DATA = json.load(json_file)
json_file.close()

UK90_TERM_DATA = pkg_resources.resource_filename(
__name__, "/data_tables/uk90_term.json") # 37-42 weeks gestation
with open(UK90_TERM_DATA) as json_file:
data_path = Path(
data_directory, "uk90_term.json") # 37-42 weeks gestation
with open(data_path) as json_file:
UK90_TERM_DATA = json.load(json_file)
json_file.close()

WHO_INFANTS_DATA = pkg_resources.resource_filename(
__name__, "/data_tables/who_infants.json") # 2 weeks to 2 years
with open(WHO_INFANTS_DATA) as json_file:
data_path = Path(
data_directory, "who_infants.json") # 2 weeks to 2 years
with open(data_path) as json_file:
WHO_INFANTS_DATA = json.load(json_file)
json_file.close()

WHO_CHILD_DATA = pkg_resources.resource_filename(
__name__, "/data_tables/who_children.json") # 2 years to 4 years
with open(WHO_CHILD_DATA) as json_file:
data_path = Path(
data_directory, "who_children.json") # 2 years to 4 years
with open(data_path) as json_file:
WHO_CHILD_DATA = json.load(json_file)
json_file.close()

UK90_CHILD_DATA = pkg_resources.resource_filename(
__name__, "/data_tables/uk90_child.json") # 4 years to 20 years
with open(UK90_CHILD_DATA) as json_file:
data_path = Path(
data_directory, "uk90_child.json") # 4 years to 20 years
with open(data_path) as json_file:
UK90_CHILD_DATA = json.load(json_file)
json_file.close()

Expand Down
56 changes: 22 additions & 34 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
from setuptools import _install_setup_requires, setup, find_packages
from setuptools import setup, find_packages
from os import path

here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()

setup(
name='rcpchgrowth',
version='3.2.0',
description='SDS and Centile calculations for UK Growth Data',
long_description="https://github.com/rcpch/digital-growth-charts/blob/master/README.md",
url='https://github.com/rcpch/digital-growth-charts/blob/master/README.md',
author='@eatyourpeas, @marcusbaw @statist7 RCPCH',

author_email='[email protected]',
name="rcpchgrowth",
version="4.0.0",
description="SDS and Centile calculations for UK Growth Data",
long_description=long_description,
url="https://github.com/rcpch/digital-growth-charts/blob/master/README.md",
author="@eatyourpeas, @marcusbaw, @statist7, RCPCH Incubator",
author_email="[email protected]",
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering :: Medical Science Apps.'
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
],
keywords='growth charts anthropometry SDS Centile',

packages=find_packages(),
python_requires='>=3.5, <3.9',
install_requires=[
'python-dateutil',
"scipy",
'six',
'pytest',
'click'
],
extras_require={
'dev': ['check-manifest'],
'test': ['coverage'],
},
keywords="growth charts, anthropometry, SDS, centile, UK-WHO, UK90, Trisomy 21, Turner",
packages=find_packages(),
python_requires=">3.8",
install_requires=["python-dateutil", "scipy"],
include_package_data=True,
project_urls={
'Bug Reports': 'https://github.com/rcpch/digital-growth-charts/issues',
'API management': 'https://dev.rcpch.ac.uk',
'Source': 'https://github.com/rcpch/digital-growth-charts',
project_urls={
"Bug Reports": "https://github.com/rcpch/rcpchgrowth-python/issues",
"API management": "https://dev.rcpch.ac.uk",
"Source": "https://github.com/rcpch/rcpchgrowth-python",
},
)

0 comments on commit 3590aef

Please sign in to comment.