Closed svittoz closed 3 months ago
Name | Stmts | Miss | Cover |
---|---|---|---|
eds_scikit/io/i2b2_mapping.pyNew 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) | 79 | 69 | 13% |
eds_scikit/biology/utils/config.pyNew 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 | 35 | 22 | 37% |
eds_scikit/utils/checks.pyNew 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)
| 71 | 10 | 86% |
eds_scikit/datasets/synthetic/biology.pyNew 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"
| 132 | 7 | 95% |
eds_scikit/period/tagging_functions.pyNew 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: | 36 | 6 | 83% |
eds_scikit/utils/test_utils.pyNew 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 | 54 | 5 | 91% |
eds_scikit/utils/bunch.pyNew 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) | 11 | 5 | 55% |
eds_scikit/resources/reg.pyNew 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 | 16 | 4 | 75% |
eds_scikit/event/diabetes.pyNew 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 | 10 | 4 | 60% |
eds_scikit/datasets/__init__.pyNew 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__] | 26 | 4 | 85% |
eds_scikit/event/from_code.pyNew 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"]] | 42 | 3 | 93% |
eds_scikit/biology/viz/plot.pyNew 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) | 130 | 3 | 98% |
eds_scikit/emergency/emergency_care_site.pyNew 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, | 31 | 2 | 94% |
eds_scikit/biology/viz/aggregate.pyNew 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
| 97 | 2 | 98% |
eds_scikit/utils/flowchart/flowchart.pyNew missing coverage at line 152 ! def __str__(self) -> str:
- return self.__repr__()
| 131 | 1 | 99% |
eds_scikit/utils/custom_implem/custom_implem.pyNew missing coverage at line 54 ! """
- return cut(
x, | 22 | 1 | 95% |
eds_scikit/resources/utils.pyNew missing coverage at line 19 ! if len(splited) == 1:
- return None
return splited[-1] | 6 | 1 | 83% |
eds_scikit/period/stays.pyNew 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 | 86 | 1 | 99% |
eds_scikit/io/base.pyNew missing coverage at line 13 ! def __str__(self):
- return self.__repr__()
| 9 | 1 | 89% |
eds_scikit/event/consultations.pyNew missing coverage at line 68 ! if type(algo) == str:
- algo = [algo]
| 61 | 1 | 98% |
eds_scikit/biology/cleaning/cohort.pyNew missing coverage at line 28 ! if isinstance(studied_pop, DataFrame.__args__):
- filtered_measures = measurement.merge(
studied_pop, | 9 | 1 | 89% |
TOTAL | 2272 | 153 | 93% |
59 files skipped due to complete coverage.
Description
Add custom codecov implementation (implemented by @percevalw in this PR)
Checklist