diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 576943b..c34d3b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ description of the proposed change, including the use case for the change. ## Contributing to the codebase -To contribute to the codebase, open a pull request on the [Pull Requests](https://github.com/Bayer-Group/phenx/pulls). +To contribute to the codebase, open a pull request on the [Pull Requests](https://github.com/Bayer-Group/PhenEx/pulls). All pull requests must be approved by at least one reviewer. If there is a dispute regarding a pull request, a second reviewer will be asked to review the diff --git a/README.md b/README.md index a6687df..83a3466 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # PhenEx: Automatic PHENotype EXtractor - +
- PhenEx Logo + PhenEx Logo
diff --git a/docs/api/phenotypes/codelist_phenotype.md b/docs/api/phenotypes/codelist_phenotype.md index efbe5f3..d47467c 100644 --- a/docs/api/phenotypes/codelist_phenotype.md +++ b/docs/api/phenotypes/codelist_phenotype.md @@ -1,3 +1,3 @@ # CodelistPhenotype -::: phenx.phenotypes.codelist_phenotype.CodelistPhenotype +::: phenex.phenotypes.codelist_phenotype.CodelistPhenotype diff --git a/docs/api/phenotypes/cohort.md b/docs/api/phenotypes/cohort.md index c36c68c..b445f94 100644 --- a/docs/api/phenotypes/cohort.md +++ b/docs/api/phenotypes/cohort.md @@ -1,3 +1,3 @@ # Cohort -::: phenx.phenotypes.cohort.Cohort +::: phenex.phenotypes.cohort.Cohort diff --git a/docs/api/phenotypes/measurement_phenotype.md b/docs/api/phenotypes/measurement_phenotype.md index f937712..e5f5558 100644 --- a/docs/api/phenotypes/measurement_phenotype.md +++ b/docs/api/phenotypes/measurement_phenotype.md @@ -1,3 +1,3 @@ # MeaurementPhenotype -::: phenx.phenotypes.measurement_phenotype.MeasurementPhenotype +::: phenex.phenotypes.measurement_phenotype.MeasurementPhenotype diff --git a/docs/tutorials/phenotypes/CodelistPhenotype_Tutorial.ipynb b/docs/tutorials/phenotypes/CodelistPhenotype_Tutorial.ipynb index 66a8500..0115833 100644 --- a/docs/tutorials/phenotypes/CodelistPhenotype_Tutorial.ipynb +++ b/docs/tutorials/phenotypes/CodelistPhenotype_Tutorial.ipynb @@ -51,7 +51,7 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.core.tables import Codelist\n", + "from phenex.core.tables import Codelist\n", "\n", "# Create a codelist for Atrial Fibrillation\n", "af_codelist = Codelist(\n", @@ -114,7 +114,7 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", + "from phenex.phenotypes import CodelistPhenotype\n", "# Ex.1 \n", "# which patients had an atrial fibrillation diagnosis at **any time** in the data source?\n", "af_phenotype = CodelistPhenotype(\n", @@ -196,8 +196,8 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.operations.filters import (\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.operations.filters import (\n", " GreaterThanOrEqualTo,\n", " LessThan,\n", " RelativeTimeRangeFilter, \n", @@ -270,8 +270,8 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.operations.filters import (\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.operations.filters import (\n", " LessThanOrEqualTo,\n", " RelativeTimeRangeFilter\n", ")\n", @@ -336,8 +336,8 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.operations.filters import (\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.operations.filters import (\n", " CategoricalFilter\n", ")\n", "\n", @@ -378,8 +378,8 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.operations.filters import (\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.operations.filters import (\n", " CategoricalFilter\n", ")\n", "\n", @@ -428,8 +428,8 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.operations.filters import (\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.operations.filters import (\n", " LessThanOrEqualTo,\n", " RelativeTimeRangeFilter, \n", " CategoricalFilter\n", @@ -498,9 +498,9 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.phenotypes import CodelistPhenotype\n", - "from phenx.operations.filters import (\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.phenotypes import CodelistPhenotype\n", + "from phenex.operations.filters import (\n", " LessThanOrEqualTo,\n", " RelativeTimeRangeFilter, \n", ")\n", diff --git a/docs/tutorials/phenotypes/MeasurementPhenotype_Tutorial.ipynb b/docs/tutorials/phenotypes/MeasurementPhenotype_Tutorial.ipynb index 6db3f12..530f690 100644 --- a/docs/tutorials/phenotypes/MeasurementPhenotype_Tutorial.ipynb +++ b/docs/tutorials/phenotypes/MeasurementPhenotype_Tutorial.ipynb @@ -114,8 +114,8 @@ "metadata": {}, "outputs": [], "source": [ - "from phenx.phenotypes import MeasurementPhenotype\n", - "from phenx.core.constants import ONEYEAR_PREINDEX\n", + "from phenex.phenotypes import MeasurementPhenotype\n", + "from phenex.core.constants import ONEYEAR_PREINDEX\n", "# Ex.1 \n", "# which patients had a measurement for systolic blood pressure recorded any time in the data source\n", "sbp1 = MeasurementPhenotype(\n", diff --git a/mkdocs.yml b/mkdocs.yml index 90b2999..8590f49 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,7 +23,7 @@ plugins: - mkdocstrings: handlers: python: - paths: [../phenx] # search packages in the src folder + paths: [../phenex] # search packages in the src folder options: docstring_style: "google" # or "numpy", "restructuredtext", etc. - mkdocs-jupyter diff --git a/phenx.png b/phenex.png similarity index 100% rename from phenx.png rename to phenex.png diff --git a/phenx/__init__.py b/phenex/__init__.py similarity index 100% rename from phenx/__init__.py rename to phenex/__init__.py diff --git a/phenx/aggregators/__init__.py b/phenex/aggregators/__init__.py similarity index 100% rename from phenx/aggregators/__init__.py rename to phenex/aggregators/__init__.py diff --git a/phenx/aggregators/aggregator.py b/phenex/aggregators/aggregator.py similarity index 100% rename from phenx/aggregators/aggregator.py rename to phenex/aggregators/aggregator.py diff --git a/phenx/aggregators/date_aggregator.py b/phenex/aggregators/date_aggregator.py similarity index 100% rename from phenx/aggregators/date_aggregator.py rename to phenex/aggregators/date_aggregator.py diff --git a/phenx/aggregators/value_aggregator.py b/phenex/aggregators/value_aggregator.py similarity index 100% rename from phenx/aggregators/value_aggregator.py rename to phenex/aggregators/value_aggregator.py diff --git a/phenx/codelists/__init__.py b/phenex/codelists/__init__.py similarity index 100% rename from phenx/codelists/__init__.py rename to phenex/codelists/__init__.py diff --git a/phenx/codelists/codelists.py b/phenex/codelists/codelists.py similarity index 100% rename from phenx/codelists/codelists.py rename to phenex/codelists/codelists.py diff --git a/phenx/filters/__init__.py b/phenex/filters/__init__.py similarity index 100% rename from phenx/filters/__init__.py rename to phenex/filters/__init__.py diff --git a/phenx/filters/aggregator.py b/phenex/filters/aggregator.py similarity index 100% rename from phenx/filters/aggregator.py rename to phenex/filters/aggregator.py diff --git a/phenx/filters/codelist_filter.py b/phenex/filters/codelist_filter.py similarity index 91% rename from phenx/filters/codelist_filter.py rename to phenex/filters/codelist_filter.py index 9894ff5..cec024d 100644 --- a/phenx/filters/codelist_filter.py +++ b/phenex/filters/codelist_filter.py @@ -1,8 +1,8 @@ import ibis -from phenx.codelists import Codelist -from phenx.tables import CodeTable, is_phenx_code_table -from phenx.filters.filter import Filter +from phenex.codelists import Codelist +from phenex.tables import CodeTable, is_phenex_code_table +from phenex.filters.filter import Filter from typing import List, Tuple import pandas as pd @@ -33,7 +33,7 @@ def _convert_codelist_to_tuples(self) -> List[Tuple[str, str]]: def _filter(self, code_table: CodeTable) -> CodeTable: - assert is_phenx_code_table(code_table) + assert is_phenex_code_table(code_table) input_columns = code_table.columns # Generate the codelist table as an Ibis literal set diff --git a/phenx/filters/date_range_filter.py b/phenex/filters/date_range_filter.py similarity index 91% rename from phenx/filters/date_range_filter.py rename to phenex/filters/date_range_filter.py index c738dca..a714090 100644 --- a/phenx/filters/date_range_filter.py +++ b/phenex/filters/date_range_filter.py @@ -1,7 +1,7 @@ from typing import Optional from datetime import date -from phenx.tables import EventTable, is_phenx_event_table +from phenex.tables import EventTable, is_phenex_event_table class DateRangeFilter: @@ -25,7 +25,7 @@ def __init__( def filter(self, table: EventTable): - assert is_phenx_event_table(table) + assert is_phenex_event_table(table) conditions = [] if self.min_date is not None: diff --git a/phenx/filters/filter.py b/phenex/filters/filter.py similarity index 100% rename from phenx/filters/filter.py rename to phenex/filters/filter.py diff --git a/phenx/filters/relative_time_range_filter.py b/phenex/filters/relative_time_range_filter.py similarity index 96% rename from phenx/filters/relative_time_range_filter.py rename to phenex/filters/relative_time_range_filter.py index 53a73ae..4007573 100644 --- a/phenx/filters/relative_time_range_filter.py +++ b/phenex/filters/relative_time_range_filter.py @@ -1,9 +1,9 @@ from typing import Optional -# from phenx.phenotypes.phenotype import Phenotype -from phenx.filters.filter import Filter -from phenx.tables import EventTable, is_phenx_phenotype_table -from phenx.filters.value import * +# from phenex.phenotypes.phenotype import Phenotype +from phenex.filters.filter import Filter +from phenex.tables import EventTable, is_phenex_phenotype_table +from phenex.filters.value import * class RelativeTimeRangeFilter(Filter): diff --git a/phenx/filters/value.py b/phenex/filters/value.py similarity index 97% rename from phenx/filters/value.py rename to phenex/filters/value.py index 64a4e49..c2ac54e 100644 --- a/phenx/filters/value.py +++ b/phenex/filters/value.py @@ -1,4 +1,4 @@ -from phenx.filters.filter import Filter +from phenex.filters.filter import Filter class Value(Filter): diff --git a/phenx/filters/value_filter.py b/phenex/filters/value_filter.py similarity index 94% rename from phenx/filters/value_filter.py rename to phenex/filters/value_filter.py index bb409f4..41e1eb3 100644 --- a/phenx/filters/value_filter.py +++ b/phenex/filters/value_filter.py @@ -1,7 +1,7 @@ from typing import Optional -from phenx.filters.filter import Filter -from phenx.tables import MeasurementTable, is_phenx_phenotype_table -from phenx.filters.value import * +from phenex.filters.filter import Filter +from phenex.tables import MeasurementTable, is_phenex_phenotype_table +from phenex.filters.value import * class ValueFilter(Filter): diff --git a/phenx/ibis_connect.py b/phenex/ibis_connect.py similarity index 100% rename from phenx/ibis_connect.py rename to phenex/ibis_connect.py diff --git a/phenx/mappers.py b/phenex/mappers.py similarity index 100% rename from phenx/mappers.py rename to phenex/mappers.py diff --git a/phenx/phenotypes/__init__.py b/phenex/phenotypes/__init__.py similarity index 100% rename from phenx/phenotypes/__init__.py rename to phenex/phenotypes/__init__.py diff --git a/phenx/phenotypes/age_phenotype.py b/phenex/phenotypes/age_phenotype.py similarity index 94% rename from phenx/phenotypes/age_phenotype.py rename to phenex/phenotypes/age_phenotype.py index 992d968..ab4ed5d 100644 --- a/phenx/phenotypes/age_phenotype.py +++ b/phenex/phenotypes/age_phenotype.py @@ -3,10 +3,10 @@ import ibis from ibis.expr.types.relations import Table -from phenx.phenotypes.phenotype import Phenotype -from phenx.filters.value import Value -from phenx.tables import PhenotypeTable, is_phenx_person_table -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.phenotypes.phenotype import Phenotype +from phenex.filters.value import Value +from phenex.tables import PhenotypeTable, is_phenex_person_table +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter class AgePhenotype(Phenotype): @@ -77,7 +77,7 @@ def __init__( def _execute(self, tables: Dict[str, Table]) -> PhenotypeTable: person_table = tables[self.domain] - assert is_phenx_person_table(person_table) + assert is_phenex_person_table(person_table) if "YEAR_OF_BIRTH" in person_table.columns: date_of_birth = ibis.coalesce( diff --git a/phenx/phenotypes/arithmetic_phenotype.py b/phenex/phenotypes/arithmetic_phenotype.py similarity index 100% rename from phenx/phenotypes/arithmetic_phenotype.py rename to phenex/phenotypes/arithmetic_phenotype.py diff --git a/phenx/phenotypes/codelist_phenotype.py b/phenex/phenotypes/codelist_phenotype.py similarity index 89% rename from phenx/phenotypes/codelist_phenotype.py rename to phenex/phenotypes/codelist_phenotype.py index 4787e89..ca3f3a8 100644 --- a/phenx/phenotypes/codelist_phenotype.py +++ b/phenex/phenotypes/codelist_phenotype.py @@ -1,12 +1,12 @@ from typing import Union, List -from phenx.phenotypes.phenotype import Phenotype -from phenx.filters.codelist_filter import CodelistFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.aggregator import First, Last -from phenx.codelists import Codelist -from phenx.tables import is_phenx_code_table, PHENOTYPE_TABLE_COLUMNS, PhenotypeTable -from phenx.phenotypes.functions import select_phenotype_columns +from phenex.phenotypes.phenotype import Phenotype +from phenex.filters.codelist_filter import CodelistFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.aggregator import First, Last +from phenex.codelists import Codelist +from phenex.tables import is_phenex_code_table, PHENOTYPE_TABLE_COLUMNS, PhenotypeTable +from phenex.phenotypes.functions import select_phenotype_columns from ibis import _ @@ -99,7 +99,7 @@ def _execute(self, tables) -> PhenotypeTable: return select_phenotype_columns(code_table) def _perform_codelist_filtering(self, code_table): - assert is_phenx_code_table(code_table) + assert is_phenex_code_table(code_table) code_table = self.codelist_filter.filter(code_table) return code_table diff --git a/phenx/phenotypes/cohort.py b/phenex/phenotypes/cohort.py similarity index 98% rename from phenx/phenotypes/cohort.py rename to phenex/phenotypes/cohort.py index b929dbd..7bb7637 100644 --- a/phenx/phenotypes/cohort.py +++ b/phenex/phenotypes/cohort.py @@ -1,9 +1,9 @@ from typing import List, Dict, Optional -from phenx.phenotypes.phenotype import Phenotype +from phenex.phenotypes.phenotype import Phenotype import ibis from ibis.expr.types.relations import Table -from phenx.tables import PhenotypeTable -from phenx.phenotypes.functions import hstack +from phenex.tables import PhenotypeTable +from phenex.phenotypes.functions import hstack def subset_and_add_index_date(tables: Dict[str, Table], index_table: PhenotypeTable): diff --git a/phenx/phenotypes/computation_graph.py b/phenex/phenotypes/computation_graph.py similarity index 96% rename from phenx/phenotypes/computation_graph.py rename to phenex/phenotypes/computation_graph.py index befce01..d73d046 100644 --- a/phenx/phenotypes/computation_graph.py +++ b/phenex/phenotypes/computation_graph.py @@ -2,7 +2,7 @@ from datetime import date import ibis from ibis.expr.types.relations import Table -from phenx.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS +from phenex.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS class ComputationGraph: diff --git a/phenx/phenotypes/computation_graph_phenotypes.py b/phenex/phenotypes/computation_graph_phenotypes.py similarity index 98% rename from phenx/phenotypes/computation_graph_phenotypes.py rename to phenex/phenotypes/computation_graph_phenotypes.py index ac7045f..4567a3f 100644 --- a/phenx/phenotypes/computation_graph_phenotypes.py +++ b/phenex/phenotypes/computation_graph_phenotypes.py @@ -1,9 +1,9 @@ from typing import Dict, Union from ibis.expr.types.relations import Table import ibis -from phenx.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS -from phenx.phenotypes.phenotype import Phenotype, ComputationGraph -from phenx.phenotypes.functions import hstack +from phenex.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS +from phenex.phenotypes.phenotype import Phenotype, ComputationGraph +from phenex.phenotypes.functions import hstack from datetime import date diff --git a/phenx/phenotypes/continuous_coverage_phenotype.py b/phenex/phenotypes/continuous_coverage_phenotype.py similarity index 100% rename from phenx/phenotypes/continuous_coverage_phenotype.py rename to phenex/phenotypes/continuous_coverage_phenotype.py diff --git a/phenx/phenotypes/death_phenotype.py b/phenex/phenotypes/death_phenotype.py similarity index 100% rename from phenx/phenotypes/death_phenotype.py rename to phenex/phenotypes/death_phenotype.py diff --git a/phenx/phenotypes/functions.py b/phenex/phenotypes/functions.py similarity index 100% rename from phenx/phenotypes/functions.py rename to phenex/phenotypes/functions.py diff --git a/phenx/phenotypes/logic_phenotype.py b/phenex/phenotypes/logic_phenotype.py similarity index 96% rename from phenx/phenotypes/logic_phenotype.py rename to phenex/phenotypes/logic_phenotype.py index b6e810b..6a91ff6 100644 --- a/phenx/phenotypes/logic_phenotype.py +++ b/phenex/phenotypes/logic_phenotype.py @@ -1,7 +1,7 @@ from typing import Dict, Union from ibis.expr.types.relations import Table -from phenx.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS -from phenx.phenotypes.phenotype import Phenotype +from phenex.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS +from phenex.phenotypes.phenotype import Phenotype class LogicPhenotype(Phenotype): diff --git a/phenx/phenotypes/measurement_phenotype.py b/phenex/phenotypes/measurement_phenotype.py similarity index 98% rename from phenx/phenotypes/measurement_phenotype.py rename to phenex/phenotypes/measurement_phenotype.py index 1d48480..0e032b7 100644 --- a/phenx/phenotypes/measurement_phenotype.py +++ b/phenex/phenotypes/measurement_phenotype.py @@ -1,7 +1,7 @@ from typing import Union, List, Optional -from phenx.phenotypes import CodelistPhenotype -from phenx.tables import is_phenx_code_table, PHENOTYPE_TABLE_COLUMNS, PhenotypeTable -from phenx.phenotypes.functions import select_phenotype_columns +from phenex.phenotypes import CodelistPhenotype +from phenex.tables import is_phenex_code_table, PHENOTYPE_TABLE_COLUMNS, PhenotypeTable +from phenex.phenotypes.functions import select_phenotype_columns from ibis import _ diff --git a/phenx/phenotypes/multiple_occurrences_phenotype.py b/phenex/phenotypes/multiple_occurrences_phenotype.py similarity index 91% rename from phenx/phenotypes/multiple_occurrences_phenotype.py rename to phenex/phenotypes/multiple_occurrences_phenotype.py index 8603dff..77d1d82 100644 --- a/phenx/phenotypes/multiple_occurrences_phenotype.py +++ b/phenex/phenotypes/multiple_occurrences_phenotype.py @@ -1,9 +1,9 @@ -from phenx.phenotypes.phenotype import Phenotype -from phenx.filters.codelist_filter import CodelistFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.codelists import Codelist -from phenx.tables import is_phenx_code_table, PHENOTYPE_TABLE_COLUMNS, PhenotypeTable +from phenex.phenotypes.phenotype import Phenotype +from phenex.filters.codelist_filter import CodelistFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.codelists import Codelist +from phenex.tables import is_phenex_code_table, PHENOTYPE_TABLE_COLUMNS, PhenotypeTable from ibis import _ diff --git a/phenx/phenotypes/person_phenotype.py b/phenex/phenotypes/person_phenotype.py similarity index 100% rename from phenx/phenotypes/person_phenotype.py rename to phenex/phenotypes/person_phenotype.py diff --git a/phenx/phenotypes/phenotype.py b/phenex/phenotypes/phenotype.py similarity index 98% rename from phenx/phenotypes/phenotype.py rename to phenex/phenotypes/phenotype.py index aac2b62..c151ae1 100644 --- a/phenx/phenotypes/phenotype.py +++ b/phenex/phenotypes/phenotype.py @@ -1,9 +1,9 @@ from typing import Dict, Union from ibis.expr.types.relations import Table -from phenx.tables import ( +from phenex.tables import ( PhenotypeTable, PHENOTYPE_TABLE_COLUMNS, - is_phenx_phenotype_table, + is_phenex_phenotype_table, ) @@ -54,7 +54,7 @@ def execute(self, tables: Dict[str, Table]) -> PhenotypeTable: ) self.table = table.select(PHENOTYPE_TABLE_COLUMNS) - assert is_phenx_phenotype_table(self.table) + assert is_phenex_phenotype_table(self.table) return self.table @@ -152,7 +152,7 @@ def get_codelists(self, to_pandas=False): from datetime import date import ibis from ibis.expr.types.relations import Table -from phenx.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS +from phenex.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS class ComputationGraph: diff --git a/phenx/phenotypes/score_phenotype.py b/phenex/phenotypes/score_phenotype.py similarity index 95% rename from phenx/phenotypes/score_phenotype.py rename to phenex/phenotypes/score_phenotype.py index 8d96f6b..bfdbb5b 100644 --- a/phenx/phenotypes/score_phenotype.py +++ b/phenex/phenotypes/score_phenotype.py @@ -1,8 +1,8 @@ import ast from typing import Dict, Union from ibis.expr.types.relations import Table -from phenx.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS -from phenx.phenotypes.phenotype import Phenotype +from phenex.tables import PhenotypeTable, PHENOTYPE_TABLE_COLUMNS +from phenex.phenotypes.phenotype import Phenotype class ScorePhenotype(Phenotype): diff --git a/phenx/tables.py b/phenex/tables.py similarity index 82% rename from phenx/tables.py rename to phenex/tables.py index c407f4e..cb475d4 100644 --- a/phenx/tables.py +++ b/phenex/tables.py @@ -1,6 +1,6 @@ from ibis.expr.types.relations import Table from dataclasses import asdict -from phenx.mappers import PersonTableColumnMapper, CodeTableColumnMapper +from phenex.mappers import PersonTableColumnMapper, CodeTableColumnMapper class PersonTable(Table): @@ -40,7 +40,7 @@ class PhenotypeTable(Table): INDEX_TABLE_COLUMNS = ["PERSON_ID", "INDEX_DATE"] -def is_phenx_person_table(table: Table) -> bool: +def is_phenex_person_table(table: Table) -> bool: """ Check if given table is a person table. One could check one row per patient? @@ -48,28 +48,28 @@ def is_phenx_person_table(table: Table) -> bool: return set(PERSON_TABLE_COLUMNS) <= set(table.columns) -def is_phenx_code_table(table: Table) -> bool: +def is_phenex_code_table(table: Table) -> bool: """ Check if given table is a code table. """ return set(CODE_TABLE_COLUMNS) <= set(table.columns + ["CODE_TYPE"]) -def is_phenx_event_table(table: Table) -> bool: +def is_phenex_event_table(table: Table) -> bool: """ Check if given table is a code table. """ return set(EVENT_TABLE_COLUMNS) <= set(table.columns) -def is_phenx_phenotype_table(table: Table) -> bool: +def is_phenex_phenotype_table(table: Table) -> bool: """ Check if given table is a code table. """ return set(PHENOTYPE_TABLE_COLUMNS) <= set(table.columns) -def is_phenx_index_table(table: Table) -> bool: +def is_phenex_index_table(table: Table) -> bool: """ Check if given table is a code table. """ diff --git a/phenx/test/__init__.py b/phenex/test/__init__.py similarity index 100% rename from phenx/test/__init__.py rename to phenex/test/__init__.py diff --git a/phenx/test/filters/test_time_range_filter.py b/phenex/test/filters/test_time_range_filter.py similarity index 93% rename from phenx/test/filters/test_time_range_filter.py rename to phenex/test/filters/test_time_range_filter.py index 17da43f..c37c186 100644 --- a/phenx/test/filters/test_time_range_filter.py +++ b/phenex/test/filters/test_time_range_filter.py @@ -2,9 +2,9 @@ # import ibis # import pandas as pd # from datetime import date -# from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -# from phenx.test.mock_phenotype import MockPhenotype -# from phenx.filters.value import GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo +# from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +# from phenex.test.mock_phenotype import MockPhenotype +# from phenex.filters.value import GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo # @pytest.fixture # def setup_tables(): diff --git a/phenx/test/mock_phenotype.py b/phenex/test/mock_phenotype.py similarity index 80% rename from phenx/test/mock_phenotype.py rename to phenex/test/mock_phenotype.py index 2c07fb5..bcc049e 100644 --- a/phenx/test/mock_phenotype.py +++ b/phenex/test/mock_phenotype.py @@ -1,7 +1,7 @@ from typing import Dict from ibis.expr.types.relations import Table -from phenx.phenotypes.phenotype import Phenotype -from phenx.tables import PhenotypeTable, is_phenx_phenotype_table +from phenex.phenotypes.phenotype import Phenotype +from phenex.tables import PhenotypeTable, is_phenex_phenotype_table class MockPhenotype(Phenotype): @@ -11,7 +11,7 @@ class MockPhenotype(Phenotype): def __init__(self, table): self.children = [] - assert is_phenx_phenotype_table(table) + assert is_phenex_phenotype_table(table) super(MockPhenotype, self).__init__() self.table = table diff --git a/phenx/test/phenotype_test_generator.py b/phenex/test/phenotype_test_generator.py similarity index 100% rename from phenx/test/phenotype_test_generator.py rename to phenex/test/phenotype_test_generator.py diff --git a/phenx/test/phenotypes/test_age_phenotype.py b/phenex/test/phenotypes/test_age_phenotype.py similarity index 93% rename from phenx/test/phenotypes/test_age_phenotype.py rename to phenex/test/phenotypes/test_age_phenotype.py index 2145286..d3b3367 100644 --- a/phenx/test/phenotypes/test_age_phenotype.py +++ b/phenex/test/phenotypes/test_age_phenotype.py @@ -1,17 +1,17 @@ import datetime, os import pandas as pd -from phenx.phenotypes.age_phenotype import AgePhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.phenotypes.age_phenotype import AgePhenotype +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator -from phenx.filters.value import Value +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.filters.value import Value -from phenx.mappers import * +from phenex.mappers import * class AgePhenotypeTestGenerator(PhenotypeTestGenerator): diff --git a/phenx/test/phenotypes/test_clpt_anchor_phenotype.py b/phenex/test/phenotypes/test_clpt_anchor_phenotype.py similarity index 93% rename from phenx/test/phenotypes/test_clpt_anchor_phenotype.py rename to phenex/test/phenotypes/test_clpt_anchor_phenotype.py index 58e9908..43704e1 100644 --- a/phenx/test/phenotypes/test_clpt_anchor_phenotype.py +++ b/phenex/test/phenotypes/test_clpt_anchor_phenotype.py @@ -1,15 +1,15 @@ import datetime, os import pandas as pd -from phenx.phenotypes.codelist_phenotype import CodelistPhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.phenotypes.codelist_phenotype import CodelistPhenotype +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator -from phenx.filters.value import ( +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.filters.value import ( GreaterThan, GreaterThanOrEqualTo, LessThan, diff --git a/phenx/test/phenotypes/test_clpt_return_date.py b/phenex/test/phenotypes/test_clpt_return_date.py similarity index 93% rename from phenx/test/phenotypes/test_clpt_return_date.py rename to phenex/test/phenotypes/test_clpt_return_date.py index f4b1821..765182d 100644 --- a/phenx/test/phenotypes/test_clpt_return_date.py +++ b/phenex/test/phenotypes/test_clpt_return_date.py @@ -1,15 +1,15 @@ import datetime, os import pandas as pd -from phenx.phenotypes.codelist_phenotype import CodelistPhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.phenotypes.codelist_phenotype import CodelistPhenotype +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator -from phenx.filters.value import ( +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.filters.value import ( GreaterThan, GreaterThanOrEqualTo, LessThan, diff --git a/phenx/test/phenotypes/test_codelist_phenotype.py b/phenex/test/phenotypes/test_codelist_phenotype.py similarity index 97% rename from phenx/test/phenotypes/test_codelist_phenotype.py rename to phenex/test/phenotypes/test_codelist_phenotype.py index 467c5c1..4400cee 100644 --- a/phenx/test/phenotypes/test_codelist_phenotype.py +++ b/phenex/test/phenotypes/test_codelist_phenotype.py @@ -1,15 +1,15 @@ import datetime, os import pandas as pd -from phenx.phenotypes.codelist_phenotype import CodelistPhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.phenotypes.codelist_phenotype import CodelistPhenotype +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator -from phenx.filters.value import * +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.filters.value import * class CodelistPhenotypeTestGenerator(PhenotypeTestGenerator): name_space = "clpt" diff --git a/phenx/test/phenotypes/test_logic_phenotype.py b/phenex/test/phenotypes/test_logic_phenotype.py similarity index 98% rename from phenx/test/phenotypes/test_logic_phenotype.py rename to phenex/test/phenotypes/test_logic_phenotype.py index 3210749..295aa3b 100644 --- a/phenx/test/phenotypes/test_logic_phenotype.py +++ b/phenex/test/phenotypes/test_logic_phenotype.py @@ -1,15 +1,15 @@ import datetime, os import pandas as pd -from phenx.phenotypes import CodelistPhenotype, LogicPhenotype +from phenex.phenotypes import CodelistPhenotype, LogicPhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator class LogicPhenotypeTestGenerator(PhenotypeTestGenerator): diff --git a/phenx/test/phenotypes/test_measurement_phenotype.py b/phenex/test/phenotypes/test_measurement_phenotype.py similarity index 98% rename from phenx/test/phenotypes/test_measurement_phenotype.py rename to phenex/test/phenotypes/test_measurement_phenotype.py index d56edde..08e7b8a 100644 --- a/phenx/test/phenotypes/test_measurement_phenotype.py +++ b/phenex/test/phenotypes/test_measurement_phenotype.py @@ -2,22 +2,22 @@ import pandas as pd import copy -from phenx.filters.value import ( +from phenex.filters.value import ( GreaterThan, GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo, ) -from phenx.phenotypes.measurement_phenotype import MeasurementPhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.value_filter import ValueFilter -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.aggregator import * -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.phenotypes.measurement_phenotype import MeasurementPhenotype +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.value_filter import ValueFilter +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.aggregator import * +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator class MeasurementPhenotypeValueFilterTestGenerator(PhenotypeTestGenerator): diff --git a/phenx/test/phenotypes/test_multiple_occurrence_phenotype.py b/phenex/test/phenotypes/test_multiple_occurrence_phenotype.py similarity index 93% rename from phenx/test/phenotypes/test_multiple_occurrence_phenotype.py rename to phenex/test/phenotypes/test_multiple_occurrence_phenotype.py index 64ad50e..e57affa 100644 --- a/phenx/test/phenotypes/test_multiple_occurrence_phenotype.py +++ b/phenex/test/phenotypes/test_multiple_occurrence_phenotype.py @@ -2,11 +2,11 @@ # import ibis # import pandas as pd # from datetime import date -# from phenx.phenotypes.multiple_occurrences_phenotype import MultipleOccurrencePhenotype -# from phenx.phenotypes.phenotype import Phenotype -# from phenx.filters.date_range_filter import DateRangeFilter -# from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -# from phenx.phenotypes.test.mock_phenotype import MockPhenotype +# from phenex.phenotypes.multiple_occurrences_phenotype import MultipleOccurrencePhenotype +# from phenex.phenotypes.phenotype import Phenotype +# from phenex.filters.date_range_filter import DateRangeFilter +# from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +# from phenex.phenotypes.test.mock_phenotype import MockPhenotype # @pytest.fixture # def setup_tables(): diff --git a/phenx/test/phenotypes/test_relative_time_range_filter.py b/phenex/test/phenotypes/test_relative_time_range_filter.py similarity index 91% rename from phenx/test/phenotypes/test_relative_time_range_filter.py rename to phenex/test/phenotypes/test_relative_time_range_filter.py index 0db5680..ede1a60 100644 --- a/phenx/test/phenotypes/test_relative_time_range_filter.py +++ b/phenex/test/phenotypes/test_relative_time_range_filter.py @@ -1,15 +1,15 @@ import datetime, os import pandas as pd -from phenx.phenotypes.codelist_phenotype import CodelistPhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.phenotypes.codelist_phenotype import CodelistPhenotype +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator -from phenx.filters.value import ( +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.filters.value import ( GreaterThan, GreaterThanOrEqualTo, LessThan, diff --git a/phenx/test/phenotypes/test_score_phenotype.py b/phenex/test/phenotypes/test_score_phenotype.py similarity index 90% rename from phenx/test/phenotypes/test_score_phenotype.py rename to phenex/test/phenotypes/test_score_phenotype.py index b08254b..0aaa3e4 100644 --- a/phenx/test/phenotypes/test_score_phenotype.py +++ b/phenex/test/phenotypes/test_score_phenotype.py @@ -1,15 +1,15 @@ import datetime, os import pandas as pd -from phenx.phenotypes import CodelistPhenotype, ScorePhenotype +from phenex.phenotypes import CodelistPhenotype, ScorePhenotype -from phenx.codelists import LocalCSVCodelistFactory -from phenx.filters.date_range_filter import DateRangeFilter -from phenx.filters.relative_time_range_filter import RelativeTimeRangeFilter -from phenx.test.util.dummy.generate_dummy_data import ( +from phenex.codelists import LocalCSVCodelistFactory +from phenex.filters.date_range_filter import DateRangeFilter +from phenex.filters.relative_time_range_filter import RelativeTimeRangeFilter +from phenex.test.util.dummy.generate_dummy_data import ( sdf_and_tt_dummycodes_3variables, ) -from phenx.test.phenotype_test_generator import PhenotypeTestGenerator +from phenex.test.phenotype_test_generator import PhenotypeTestGenerator class ScorePhenotypeTestGenerator(PhenotypeTestGenerator): diff --git a/phenx/test/util/check_equality.py b/phenex/test/util/check_equality.py similarity index 100% rename from phenx/test/util/check_equality.py rename to phenex/test/util/check_equality.py diff --git a/phenx/test/util/clean.py b/phenex/test/util/clean.py similarity index 100% rename from phenx/test/util/clean.py rename to phenex/test/util/clean.py diff --git a/phenx/test/util/dummy/codelists.csv b/phenex/test/util/dummy/codelists.csv similarity index 100% rename from phenx/test/util/dummy/codelists.csv rename to phenex/test/util/dummy/codelists.csv diff --git a/phenx/test/util/dummy/create_medical_codes_table.py b/phenex/test/util/dummy/create_medical_codes_table.py similarity index 100% rename from phenx/test/util/dummy/create_medical_codes_table.py rename to phenex/test/util/dummy/create_medical_codes_table.py diff --git a/phenx/test/util/dummy/generate_dummy_data.py b/phenex/test/util/dummy/generate_dummy_data.py similarity index 99% rename from phenx/test/util/dummy/generate_dummy_data.py rename to phenex/test/util/dummy/generate_dummy_data.py index ab8ed3d..b6c2d24 100644 --- a/phenx/test/util/dummy/generate_dummy_data.py +++ b/phenex/test/util/dummy/generate_dummy_data.py @@ -2,7 +2,7 @@ import pandas as pd import yaml import datetime -from phenx.test.util.dummy.create_medical_codes_table import ( +from phenex.test.util.dummy.create_medical_codes_table import ( create_dummy_medical_codes_data, ) diff --git a/setup.py b/setup.py index 0bb6288..0c7af72 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ def parse_requirements(filename): setup( - name="phenx", + name="phenex", version="0.0.1", author="Bayer AG", author_email="alexander.hartenstein@bayer.com",