Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![codecov](https://codecov.io/gh/codonlibrary/codonPython/branch/master/graph/badge.svg)](https://codecov.io/gh/codonlibrary/codonPython)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## What is `codon`?
## What is `codon`?

The `codon` project was created to increase code sharing, code consistency, coding standards, and encourage collaboration. Package documentation is available on the [GitHub pages](https://codonlibrary.github.io/codonPython/). `codonPython` aims to reduce the barrier for entry for analysis and provide software development experience for those at a higher level of technical ability.

Expand Down
1,736 changes: 1,736 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[tool.poetry]
name = "codonpython"
version = "0.2.1"
description = "This is a first attempt at how our package will work."
authors = ["NHS Digital DIS Team"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10"
pandas = ">=2.2.3"
numpy = ">=2.1.3"
scipy = ">=1.14.1"
sqlalchemy = ">=2.0.36"
scikit-learn = ">=1.5.2"
statsmodels = ">=0.14.4"
seaborn = ">=0.13.2"
sphinx = ">=8.1.3"
sphinx-rtd-theme = ">=3.0.1"
flake8 = ">=7.1.1"
m2r = ">=0.3.1"
pytest = ">=8.3.3"


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
11 changes: 0 additions & 11 deletions requirements.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def check_nat_val(
raise KeyError("Check column names correspond to the DataFrame.")
# aggregate values by measure and breakdown
grouped = (
df.groupby([measure_col, breakdown_col]).agg({value_col: sum}).reset_index()
df.groupby([measure_col, breakdown_col]).agg({value_col: "sum"}).reset_index()
)
national = grouped.loc[grouped[breakdown_col] == nat_val].reset_index()
non_national = grouped.loc[grouped[breakdown_col] != nat_val].reset_index()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 11 additions & 12 deletions codonPython/tolerance.py → src/codonpython/tolerance.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,17 @@ def check_tolerance(
_, yhat_l, yhat_u = wls_prediction_std(model, t_predict, alpha=alpha)

# Store model results in master frame
results = results.append(
pd.DataFrame(
{
"t": t_orig,
"yhat_u": yhat_u,
"yobs": y_predict,
"yhat": yhat,
"yhat_l": yhat_l,
"polynomial": degree,
}
),
ignore_index=True,
degree_results = pd.DataFrame(
{
"t": t_orig,
"yhat_u": yhat_u,
"yobs": y_predict,
"yhat": yhat,
"yhat_l": yhat_l,
"polynomial": degree,
}
)

results = pd.concat([results, degree_results], ignore_index=True)

return results
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython import age_bands
from codonpython import age_bands
import numpy as np
import math
import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython.check_consistent_measures import check_consistent_measures
from codonpython.check_consistent_measures import check_consistent_measures
import pandas as pd
import numpy as np
import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython.check_consistent_submissions import check_consistent_submissions
from codonpython.check_consistent_submissions import check_consistent_submissions
import pandas as pd
import numpy as np
import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython.check_nat_val import check_nat_val
from codonpython.check_nat_val import check_nat_val
import pytest
import pandas as pd

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython.check_null import check_null
from codonpython.check_null import check_null
import numpy as np
import pandas as pd
import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython import dateValidator
from codonpython import dateValidator
import pytest


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from codonPython.file_utils import compare
from codonPython.file_utils import file_search
from codonPython.file_utils import import_files
from codonpython.file_utils import compare
from codonpython.file_utils import file_search
from codonpython.file_utils import import_files
import numpy as np
import pytest
import pandas as pd
Expand Down Expand Up @@ -90,26 +90,27 @@ def test_compare_BAU(x, y, names, dups, same, expected):
assert list_test1 == list_exp



@pytest.mark.parametrize(
"doctype, like, strict, expected", [("md", ["README"], True, ["README.md"])]
)
def test_file_search_BAU(doctype, like, strict, expected):
assert file_search(doctype=doctype, like=like, strict=strict) == expected

file_import_path = './tests'

@pytest.mark.parametrize("expected", [({})])
def test_import_files_BAU(expected):
assert import_files() == expected

assert import_files(file_import_path) == expected

@pytest.mark.parametrize("subdir, expected", [(True, {})])
def test_import_files_BAU_2(subdir, expected):
assert import_files(subdir=subdir) == expected
assert import_files(file_import_path, subdir=subdir) == expected


@pytest.mark.parametrize("strict,subdir, expected", [(True, True, {})])
def test_import_files_BAU_3(strict, subdir, expected):
assert import_files(strict=strict, subdir=subdir) == expected
assert import_files(file_import_path, strict=strict, subdir=subdir) == expected


# ----------------Console output-------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython.nhsNumber import nhsNumberGenerator, nhsNumberValidator
from codonpython.nhsNumber import nhsNumberGenerator, nhsNumberValidator
import pytest
import random

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from codonPython.suppression import suppress_value
from codonpython.suppression import suppress_value
import pytest


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from codonPython.tolerance import check_tolerance
from codonpython.tolerance import check_tolerance
import numpy as np
import pandas as pd
import pandas.util.testing as pdt
import pandas.testing as pdt
import pytest

testdata = [
Expand Down