From 75c02919b28e1bc2daba04718f53cfe541c48a15 Mon Sep 17 00:00:00 2001 From: Dian SUN <38680131+dsun0720@users.noreply.github.com> Date: Thu, 1 Oct 2020 11:26:24 +0200 Subject: [PATCH] CNAM-453: confidence degree in ssr and had (#35) --- scalpel/stats/flattening_confidence_degree.py | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/scalpel/stats/flattening_confidence_degree.py b/scalpel/stats/flattening_confidence_degree.py index 1cc0964..f03b259 100644 --- a/scalpel/stats/flattening_confidence_degree.py +++ b/scalpel/stats/flattening_confidence_degree.py @@ -47,7 +47,31 @@ "MCO_FASTC": {"CodeSex": "COD_SEX", "ExitYear": "SOR_ANN", "ExitMonth": "SOR_MOI"}, } -_CNAM_COLS_MAPPING = {"DCIR": _DCIR_COLS, "MCO": _MCO_COLS, "MCO_CE": _MCO_CE_COLS} +_SSR_COLS = { + "SSR_B": {"DP": "MOR_PRP", "DR": "ETL_AFF", "FP_PEC": "FP_PEC"}, + "SSR_D": {"DA": "DGN_COD"}, + "SSR_CCAM": {"CCAM": "CCAM_ACT"}, + "SSR_CSARR": {"CSARR": "CSARR_COD"}, +} + +_SSR_CE_COLS = { + "SSR_FMSTC": {"CamCode": "CCAM_COD"}, +} + +_HAD_COLS = { + "HAD_A": {"CCAM": "CCAM_COD"}, + "HAD_B": {"DP": "DGN_PAL", "PEC_PAL": "PEC_PAL", "PEC_ASS": "PEC_ASS"}, + "HAD_D": {"DA": "DGN_ASS"}, +} + +_CNAM_COLS_MAPPING = { + "DCIR": _DCIR_COLS, + "MCO": _MCO_COLS, + "MCO_CE": _MCO_CE_COLS, + "SSR": _SSR_COLS, + "SSR_CE": _SSR_CE_COLS, + "HAD": _HAD_COLS, +} @ylabel("Confidence Degree(%)", CONTEXT_SEABORN) @@ -145,6 +169,12 @@ def _confidence_degree_agg(flat_table: FlatTable, **kwargs) -> PDDataFrame: group_by_cols = frozenset(["ETA_NUM", "RSA_NUM"]) elif flat_table.name == "MCO_CE": group_by_cols = frozenset(["ETA_NUM", "SEQ_NUM"]) + elif flat_table.name == "SSR": + group_by_cols = frozenset(["ETA_NUM", "RHA_NUM", "RHS_NUM"]) + elif flat_table.name == "SSR_CE": + group_by_cols = frozenset(["ETA_NUM", "SEQ_NUM"]) + elif flat_table.name == "HAD": + group_by_cols = frozenset(["ETA_NUM_EPMSI", "RHAD_NUM"]) else: group_by_cols = None col = when(max("count") != 0, min("count") / max("count") * 100).otherwise(0)