diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e54978..4c98629 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,7 +20,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' - name: Install dependencies run: | @@ -39,7 +39,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' - name: Install linters run: | diff --git a/cumulus_library_data_metrics/__init__.py b/cumulus_library_data_metrics/__init__.py index 2a2a708..15ce0cd 100644 --- a/cumulus_library_data_metrics/__init__.py +++ b/cumulus_library_data_metrics/__init__.py @@ -1,3 +1,3 @@ """Data Metrics study for Cumulus Library""" -__version__ = "4.0.2" +__version__ = "5.0.0" diff --git a/cumulus_library_data_metrics/base.py b/cumulus_library_data_metrics/base.py index dad164d..af51062 100644 --- a/cumulus_library_data_metrics/base.py +++ b/cumulus_library_data_metrics/base.py @@ -5,8 +5,8 @@ import sys from typing import ClassVar +import cumulus_library import jinja2 -from cumulus_library import base_utils from cumulus_library.template_sql import sql_utils from cumulus_library_data_metrics import resource_info @@ -78,7 +78,7 @@ def _clear_deep_docref_date(self, field: str) -> None: if not self.schemas["DocumentReference"]["context"]["period"][field]: self.date_fields["DocumentReference"].remove(f"context.period.{field}") - def _query_schema(self, config: base_utils.StudyConfig) -> None: + def _query_schema(self, config: cumulus_library.StudyConfig) -> None: fields_to_check = copy.deepcopy(self.uses_fields) # Check for some known deep fields especially - if the list of fields grows, we should @@ -93,7 +93,7 @@ def _query_schema(self, config: base_utils.StudyConfig) -> None: if check_docref_end: self._clear_deep_docref_date("end") - def extra_schema_checks(self, config: base_utils.StudyConfig) -> None: + def extra_schema_checks(self, config: cumulus_library.StudyConfig) -> None: pass def add_metric_queries(self) -> None: @@ -102,7 +102,7 @@ def add_metric_queries(self) -> None: def prepare_queries( self, *args, - config: base_utils.StudyConfig, + config: cumulus_library.StudyConfig, **kwargs, ) -> None: self.output_mode = self.get_output_mode(config) @@ -110,9 +110,9 @@ def prepare_queries( self.extra_schema_checks(config) self.add_metric_queries() - def get_output_mode(self, config: base_utils.StudyConfig) -> str: + def get_output_mode(self, config: cumulus_library.StudyConfig) -> str: output_mode = ( - (config.options and config.options.get("output-mode")) + config.options.get("output-mode") # Deprecated approach (before --option existed) -- let it lie for now or os.environ.get("DATA_METRICS_OUTPUT_MODE") ) diff --git a/cumulus_library_data_metrics/c_pt_count/c_pt_count.py b/cumulus_library_data_metrics/c_pt_count/c_pt_count.py index 444d04b..9439234 100644 --- a/cumulus_library_data_metrics/c_pt_count/c_pt_count.py +++ b/cumulus_library_data_metrics/c_pt_count/c_pt_count.py @@ -2,12 +2,12 @@ from typing import ClassVar -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.base import MetricMixin -class PatientCountBuilder(MetricMixin, BaseTableBuilder): +class PatientCountBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "c_pt_count" uses_fields: ClassVar[dict] = { "Patient": { diff --git a/cumulus_library_data_metrics/c_pt_deceased_count/c_pt_deceased_count.py b/cumulus_library_data_metrics/c_pt_deceased_count/c_pt_deceased_count.py index d315738..37fdab3 100644 --- a/cumulus_library_data_metrics/c_pt_deceased_count/c_pt_deceased_count.py +++ b/cumulus_library_data_metrics/c_pt_deceased_count/c_pt_deceased_count.py @@ -1,11 +1,11 @@ """Module for generating c_pt_deceased_count tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.base import MetricMixin -class DeceasedCountBuilder(MetricMixin, BaseTableBuilder): +class DeceasedCountBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "c_pt_deceased_count" def add_metric_queries(self, *args, **kwargs) -> None: diff --git a/cumulus_library_data_metrics/c_resource_count/c_resource_count.py b/cumulus_library_data_metrics/c_resource_count/c_resource_count.py index 44cc9f6..4b90754 100644 --- a/cumulus_library_data_metrics/c_resource_count/c_resource_count.py +++ b/cumulus_library_data_metrics/c_resource_count/c_resource_count.py @@ -1,12 +1,12 @@ """Module for generating c_resource_count tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics import resource_info from cumulus_library_data_metrics.base import MetricMixin -class ResourceCountBuilder(MetricMixin, BaseTableBuilder): +class ResourceCountBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "c_resource_count" def make_tables(self, src: str) -> None: diff --git a/cumulus_library_data_metrics/c_resources_per_pt/c_resources_per_pt.py b/cumulus_library_data_metrics/c_resources_per_pt/c_resources_per_pt.py index c26c8d8..a0fa9f9 100644 --- a/cumulus_library_data_metrics/c_resources_per_pt/c_resources_per_pt.py +++ b/cumulus_library_data_metrics/c_resources_per_pt/c_resources_per_pt.py @@ -1,12 +1,12 @@ """Module for generating c_resources_per_pt tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics import resource_info from cumulus_library_data_metrics.base import MetricMixin -class ResourcesPerPatientBuilder(MetricMixin, BaseTableBuilder): +class ResourcesPerPatientBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "c_resources_per_pt" def add_metric_queries(self) -> None: diff --git a/cumulus_library_data_metrics/c_system_use/c_system_use.py b/cumulus_library_data_metrics/c_system_use/c_system_use.py index bdc6b23..e1c9474 100644 --- a/cumulus_library_data_metrics/c_system_use/c_system_use.py +++ b/cumulus_library_data_metrics/c_system_use/c_system_use.py @@ -1,6 +1,6 @@ """Module for generating c_system_use tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics import systems from cumulus_library_data_metrics.base import MetricMixin @@ -10,7 +10,7 @@ # We already had to drop one planned column (has_text) from it due to performance. -class SystemUseBuilder(MetricMixin, BaseTableBuilder): +class SystemUseBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "c_system_use" def make_table(self, **kwargs) -> None: diff --git a/cumulus_library_data_metrics/c_us_core_v4_count/c_us_core_v4_count.py b/cumulus_library_data_metrics/c_us_core_v4_count/c_us_core_v4_count.py index 030c2fa..edb4c49 100644 --- a/cumulus_library_data_metrics/c_us_core_v4_count/c_us_core_v4_count.py +++ b/cumulus_library_data_metrics/c_us_core_v4_count/c_us_core_v4_count.py @@ -1,11 +1,11 @@ """Module for generating c_us_core_v4_count tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.us_core_v4 import UsCoreV4Mixin -class UsCoreV4CountBuilder(UsCoreV4Mixin, BaseTableBuilder): +class UsCoreV4CountBuilder(UsCoreV4Mixin, cumulus_library.BaseTableBuilder): name = "c_us_core_v4_count" def make_table(self, **kwargs) -> None: diff --git a/cumulus_library_data_metrics/manifest.toml b/cumulus_library_data_metrics/manifest.toml index cfd820c..440534b 100644 --- a/cumulus_library_data_metrics/manifest.toml +++ b/cumulus_library_data_metrics/manifest.toml @@ -41,7 +41,7 @@ export_list = [ "data_metrics__count_c_resource_count_patient_all", "data_metrics__count_c_resource_count_procedure_month", "data_metrics__count_c_resource_count_procedure_year", - #"data_metrics__c_resources_per_pt_summary", # disabled until library 3.0 + "data_metrics__c_resources_per_pt_summary", "data_metrics__count_c_system_use_allergyintolerance_code", "data_metrics__count_c_system_use_condition_code", "data_metrics__count_c_system_use_device_type", @@ -87,9 +87,9 @@ export_list = [ "data_metrics__count_c_us_core_v4_count_patient_must_support", "data_metrics__count_c_us_core_v4_count_procedure_mandatory", "data_metrics__count_c_us_core_v4_count_procedure_must_support", - #"data_metrics__q_date_recent_summary", # disabled until library 3.0 - #"data_metrics__q_ref_target_pop_summary", # disabled until library 3.0 - #"data_metrics__q_ref_target_valid_summary", # disabled until library 3.0 - #"data_metrics__q_system_use_summary", # disabled until library 3.0 - #"data_metrics__q_valid_us_core_v4_summary", # disabled until library 3.0 + "data_metrics__q_date_recent_summary", + "data_metrics__q_ref_target_pop_summary", + "data_metrics__q_ref_target_valid_summary", + "data_metrics__q_system_use_summary", + "data_metrics__q_valid_us_core_v4_summary", ] diff --git a/cumulus_library_data_metrics/meta/meta.py b/cumulus_library_data_metrics/meta/meta.py index 833c36a..f464342 100644 --- a/cumulus_library_data_metrics/meta/meta.py +++ b/cumulus_library_data_metrics/meta/meta.py @@ -1,11 +1,11 @@ """Sets study metadata""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.base import MetricMixin -class MetadataBuilder(MetricMixin, BaseTableBuilder): +class MetadataBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "meta" def add_date_query(self) -> None: diff --git a/cumulus_library_data_metrics/q_date_recent/q_date_recent.py b/cumulus_library_data_metrics/q_date_recent/q_date_recent.py index 8278d51..05be134 100644 --- a/cumulus_library_data_metrics/q_date_recent/q_date_recent.py +++ b/cumulus_library_data_metrics/q_date_recent/q_date_recent.py @@ -2,12 +2,12 @@ Module for generating q_date_recent tables """ -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.base import MetricMixin -class DateRecentBuilder(MetricMixin, BaseTableBuilder): +class DateRecentBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "q_date_recent" def make_table(self, **kwargs) -> None: diff --git a/cumulus_library_data_metrics/q_ref_target_pop/q_ref_target_pop.py b/cumulus_library_data_metrics/q_ref_target_pop/q_ref_target_pop.py index f093103..08474d3 100644 --- a/cumulus_library_data_metrics/q_ref_target_pop/q_ref_target_pop.py +++ b/cumulus_library_data_metrics/q_ref_target_pop/q_ref_target_pop.py @@ -1,11 +1,11 @@ """Module for generating q_ref_target_pop tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.base import MetricMixin -class TargetPopBuilder(MetricMixin, BaseTableBuilder): +class TargetPopBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "q_ref_target_pop" def make_table(self, **kwargs) -> str: diff --git a/cumulus_library_data_metrics/q_ref_target_valid/q_ref_target_valid.py b/cumulus_library_data_metrics/q_ref_target_valid/q_ref_target_valid.py index 440c24e..9736d63 100644 --- a/cumulus_library_data_metrics/q_ref_target_valid/q_ref_target_valid.py +++ b/cumulus_library_data_metrics/q_ref_target_valid/q_ref_target_valid.py @@ -2,12 +2,12 @@ from typing import ClassVar -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.base import MetricMixin -class TargetValidBuilder(MetricMixin, BaseTableBuilder): +class TargetValidBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "q_ref_target_valid" uses_fields: ClassVar[dict] = { diff --git a/cumulus_library_data_metrics/q_system_use/q_system_use.py b/cumulus_library_data_metrics/q_system_use/q_system_use.py index 391119b..42c1e48 100644 --- a/cumulus_library_data_metrics/q_system_use/q_system_use.py +++ b/cumulus_library_data_metrics/q_system_use/q_system_use.py @@ -1,12 +1,12 @@ """Module for generating q_system_use tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics import systems from cumulus_library_data_metrics.base import MetricMixin -class SystemUseBuilder(MetricMixin, BaseTableBuilder): +class SystemUseBuilder(MetricMixin, cumulus_library.BaseTableBuilder): name = "q_system_use" def make_table(self, **kwargs) -> None: diff --git a/cumulus_library_data_metrics/q_valid_us_core_v4/q_valid_us_core_v4.py b/cumulus_library_data_metrics/q_valid_us_core_v4/q_valid_us_core_v4.py index 1a5d51b..b477014 100644 --- a/cumulus_library_data_metrics/q_valid_us_core_v4/q_valid_us_core_v4.py +++ b/cumulus_library_data_metrics/q_valid_us_core_v4/q_valid_us_core_v4.py @@ -1,11 +1,11 @@ """Module for generating q_valid_us_core_v4 tables""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.us_core_v4 import UsCoreV4Mixin -class ValidUsCoreV4Builder(UsCoreV4Mixin, BaseTableBuilder): +class ValidUsCoreV4Builder(UsCoreV4Mixin, cumulus_library.BaseTableBuilder): name = "q_valid_us_core_v4" def make_table(self, **kwargs) -> None: diff --git a/cumulus_library_data_metrics/t_us_core_v4/t_us_core_v4.py b/cumulus_library_data_metrics/t_us_core_v4/t_us_core_v4.py index 297d630..ef795cd 100644 --- a/cumulus_library_data_metrics/t_us_core_v4/t_us_core_v4.py +++ b/cumulus_library_data_metrics/t_us_core_v4/t_us_core_v4.py @@ -1,11 +1,11 @@ """Fake/test metric for us_core_v4 profiles""" -from cumulus_library.base_table_builder import BaseTableBuilder +import cumulus_library from cumulus_library_data_metrics.us_core_v4 import UsCoreV4Mixin -class TestUsCoreV4Builder(UsCoreV4Mixin, BaseTableBuilder): +class TestUsCoreV4Builder(UsCoreV4Mixin, cumulus_library.BaseTableBuilder): name = "t_us_core_v4" def make_table(self, **kwargs) -> None: diff --git a/pyproject.toml b/pyproject.toml index 1a5050b..5fc7ff9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [project] name = "cumulus-library-data-metrics" -requires-python = ">= 3.10" +requires-python = ">= 3.11" dependencies = [ - "cumulus-library >= 2.3, < 3", + "cumulus-library >= 3, < 4", ] description = "Data quality and characterization metrics for Cumulus" readme = "README.md"