Skip to content

Commit

Permalink
Merge pull request #59 from smart-on-fhir/mikix/library3
Browse files Browse the repository at this point in the history
Update to cumulus-library 3.0
  • Loading branch information
mikix authored Aug 21, 2024
2 parents 1140ec6 + f39ed15 commit 73a8743
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion cumulus_library_data_metrics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Data Metrics study for Cumulus Library"""

__version__ = "4.0.2"
__version__ = "5.0.0"
12 changes: 6 additions & 6 deletions cumulus_library_data_metrics/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -102,17 +102,17 @@ 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)
self._query_schema(config)
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")
)
Expand Down
4 changes: 2 additions & 2 deletions cumulus_library_data_metrics/c_pt_count/c_pt_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions cumulus_library_data_metrics/c_system_use/c_system_use.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
12 changes: 6 additions & 6 deletions cumulus_library_data_metrics/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
]
4 changes: 2 additions & 2 deletions cumulus_library_data_metrics/meta/meta.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions cumulus_library_data_metrics/q_date_recent/q_date_recent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
4 changes: 2 additions & 2 deletions cumulus_library_data_metrics/q_system_use/q_system_use.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions cumulus_library_data_metrics/t_us_core_v4/t_us_core_v4.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 73a8743

Please sign in to comment.