aphp / eds-scikit

eds-scikit is a Python library providing tools to process and analyse OMOP data
https://aphp.github.io/eds-scikit
BSD 3-Clause "New" or "Revised" License
35 stars 5 forks source link

Codecov #66

Closed svittoz closed 3 months ago

svittoz commented 3 months ago

Description

Add custom codecov implementation (implemented by @percevalw in this PR)

Checklist

github-actions[bot] commented 3 months ago

Coverage Report

NameStmtsMissCover
eds_scikit/io/i2b2_mapping.py

New missing coverage at lines 38-211 !


-     i2b2_table_name = i2b2_tables[db_source][table]
-     # Dictionary of omop_col -> i2b2_col
-     columns = i2b2_renaming.get(table)
- 
-     # Can be None if creating a table from scratch (e.g. concept_relationship
-     if columns is not None:
-         query = f"describe {db_name}.{i2b2_table_name}"
  ...
-                 T.StructField("relationship_id", T.StringType(), True),
-             ]
-         )
-         if "get_additional_i2b2_concept_relationship" in registry.data.get_all():
-             data = registry.get("data", "get_additional_i2b2_concept_relationship")()
-         df = spark_session.createDataFrame(data, schema).cache()
-     return df
New missing coverage at lines 230-234 !

-     def f(x):
-         return mapping.get(x, default)
- 
-     return F.udf(f)

796913%
eds_scikit/biology/utils/config.py

New missing coverage at lines 30-66 !

     """
-     my_custom_config = pd.DataFrame()
-     for concepts_set in concepts_sets:
-         try:
-             stats = pd.read_pickle(
-                 "{}/{}/measurement_stats.pkl".format(stats_folder, concepts_set.name)
-             )
-             stats["transformed_unit"] = (
  ...
-         ]
- 
-     os.makedirs(CONFIGS_PATH, exist_ok=True)
- 
-     my_custom_config.to_csv("{}/{}.csv".format(CONFIGS_PATH, config_name), index=False)
- 
-     register_configs()
New missing coverage at lines 73-75 !
     for config in glob.glob(os.path.join(CONFIGS_PATH, "*.csv")):
-         config_name = Path(config).stem
-         registry.data.register(
             f"get_biology_config.{config_name}",
New missing coverage at lines 89-94 !
     """
-     registered = list(registry.data.get_all().keys())
-     configs = [
-         r.split(".")[-1] for r in registered if r.startswith("get_biology_config")
-     ]
-     return configs

352237%
eds_scikit/utils/checks.py

New missing coverage at line 127 !

         if return_index_or_key:
-             return kwargs[argname], argname
         return kwargs[argname]
New missing coverage at line 149 !
         else:
-             to_display_per_concept = [f"- {concept}" for concept in required_concepts]
         str_to_display = "\n".join(to_display_per_concept)
New missing coverage at lines 172-189 !

-         if all(isinstance(table, tuple) for table in required_tables):
-             to_display_per_table = [
-                 f"- {table} ({msg})" for table, msg in required_tables
-             ]
-         else:
-             to_display_per_table = [f"- {table}" for table in required_tables]
-         str_to_display = "\n".join(to_display_per_table)
- 
-         if data_name:
-             data_name = f" {data_name} "
-         message = (
-             f"The {data_name}Data is missing some tables, "
-             "namely:\n"
-             f"{str_to_display}"
-         )
- 
-         super().__init__(message)

711086%
eds_scikit/datasets/synthetic/biology.py

New missing coverage at lines 37-44 !

     def reset_to_pandas(self):
-         if self.module == "koalas":
-             self.measurement = self.pd_measurement
-             self.concept = self.pd_concept
-             self.concept_relationship = self.pd_concept_relationship
-             self.care_site = self.pd_care_site
-             self.visit_occurrence = self.pd_visit_occurrence
-             self.module = "pandas"

132795%
eds_scikit/period/tagging_functions.py

New missing coverage at lines 60-63 !

         # TODO: is this necessary ?
-         logger.warning("No matching were found between the 2 DataFrames")
- 
-         return framework.DataFrame(
             columns=["person_id", "t_start", "t_end", "concept", "value"]
New missing coverage at lines 119-123 !
         return (B_start >= A_start) & (B_end <= A_end)
-     elif algo == interval_algos.from_before_to:
-         return B_end <= A_start
-     elif algo == interval_algos.to_before_from:
-         return A_end <= B_start
     else:

36683%
eds_scikit/utils/test_utils.py

New missing coverage at line 50 !

 def date(s):
-     return dt.strptime(s, "%Y-%m-%d")
New missing coverage at lines 88-90 !
         args = tuple(args)
-     elif type(index_or_key) == str:
-         kwargs[index_or_key] = inputs
New missing coverage at lines 114-116 !
     else:
-         normalized_sum_sq_diff = sum_sq_diff / np.sqrt(sum_sq_diff)
-         assert normalized_sum_sq_diff < 0.001

54591%
eds_scikit/utils/bunch.py

New missing coverage at line 32 !

     def __setattr__(self, key, value):
-         self[key] = value
New missing coverage at line 35 !
     def __dir__(self):
-         return self.keys()
New missing coverage at lines 38-41 !
     def __getattr__(self, key):
-         try:
-             return self[key]
-         except KeyError:
             raise AttributeError(key)

11555%
eds_scikit/resources/reg.py

New missing coverage at lines 50-78 !

             # Looking for a match excluding version string
-             candidates = [
-                 func for func in candidates if function_name == func.split(".")[0]
-             ]
-             if len(candidates) > 1:
-                 # Multiple versions available, a specific one should be specified
-                 raise ValueError(
-                     (
  ...
-                         "from eds_scikit.resources import registry\n"
-                         f"@registry.{key}('{function_name}')"
-                         f"def your_custom_func(args, **kwargs):",
-                         "   ...",
-                     )
-                 )
-             func = r.get(candidates[0])
         return func

16475%
eds_scikit/event/diabetes.py

New missing coverage at lines 88-102 !

     """
-     diabetes = conditions_from_icd10(
-         condition_occurrence=condition_occurrence,
-         visit_occurrence=visit_occurrence,
-         date_min=date_min,
-         date_max=date_max,
-         codes=codes,
-         date_from_visit=date_from_visit,
-         additional_filtering=additional_filtering,
-     )
- 
-     diabetes["value"] = diabetes["concept"]
-     diabetes["concept"] = "DIABETES_FROM_ICD10"
- 
-     return diabetes

10460%
eds_scikit/datasets/__init__.py

New missing coverage at line 38 !

 def __dir__():
-     return known_datasets + [func.__name__ for func in __all__]
New missing coverage at lines 52-56 !
 def add_dataset(table: pd.DataFrame, name: str):
-     dataset_path = os.path.abspath(
-         os.path.join(os.path.dirname(__file__), name + ".csv")
-     )
-     table.to_csv(dataset_path, index=False)
New missing coverage at line 67 !
     """
-     return [func.__name__ for func in __all__]

26485%
eds_scikit/event/from_code.py

New missing coverage at lines 108-111 !

     else:
-         event.loc[:, "t_start"] = event.loc[:, columns["code_start_datetime"]]
-         event.loc[:, "t_end"] = event.loc[:, columns["code_end_datetime"]]
-         event = event.drop(
             columns=[columns["code_start_datetime"], columns["code_end_datetime"]]

42393%
eds_scikit/biology/viz/plot.py

New missing coverage at line 72 !

     else:
-         logger.error(
             "The folder {} has not been found",
New missing coverage at lines 718-720 !
     else:
-         terminologies_hist = alt.Chart().mark_text()
-         terminologies_time_series = (
             alt.Chart(measurement)

130398%
eds_scikit/emergency/emergency_care_site.py

New missing coverage at line 54 !

     if algo == "from_regex_on_parent_UF":
-         return from_regex_on_parent_UF(care_site)
     elif algo == "from_regex_on_care_site_description":
New missing coverage at line 166 !
     """
-     return attributes.get_parent_attributes(
         care_site,

31294%
eds_scikit/biology/viz/aggregate.py

New missing coverage at line 83 !

     if stats_only:
-         return {"measurement_stats": measurement_stats}
New missing coverage at line 208 !
     if overall_only:
-         return measurement_stats_overall

97298%
eds_scikit/utils/flowchart/flowchart.py

New missing coverage at line 152 !

     def __str__(self) -> str:
-         return self.__repr__()

131199%
eds_scikit/utils/custom_implem/custom_implem.py

New missing coverage at line 54 !

         """
-         return cut(
             x,

22195%
eds_scikit/resources/utils.py

New missing coverage at line 19 !

     if len(splited) == 1:
-         return None
     return splited[-1]

6183%
eds_scikit/period/stays.py

New missing coverage at line 409 !

         if open_stay_end_datetime is None:
-             open_stay_end_datetime = datetime.now()
         vo["visit_end_datetime_calc"] = open_stay_end_datetime

86199%
eds_scikit/io/base.py

New missing coverage at line 13 !

     def __str__(self):
-         return self.__repr__()

9189%
eds_scikit/event/consultations.py

New missing coverage at line 68 !

     if type(algo) == str:
-         algo = [algo]

61198%
eds_scikit/biology/cleaning/cohort.py

New missing coverage at line 28 !

     if isinstance(studied_pop, DataFrame.__args__):
-         filtered_measures = measurement.merge(
             studied_pop,

9189%
TOTAL227215393%

59 files skipped due to complete coverage.