From b885de0aa78208527e0bd124142f55f2c1586550 Mon Sep 17 00:00:00 2001 From: Abhishek Dasgupta Date: Mon, 18 Nov 2024 16:14:06 +0000 Subject: [PATCH] Handle multiselect case differently in read_arc_schema() --- src/arcmapper/arc.py | 6 +++--- src/arcmapper/strategies.py | 2 ++ src/arcmapper/types.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/arcmapper/arc.py b/src/arcmapper/arc.py index c97e2c6..d313d42 100644 --- a/src/arcmapper/arc.py +++ b/src/arcmapper/arc.py @@ -15,12 +15,12 @@ def read_arc_schema( arc_version_or_file: str, preset: str | None = None ) -> pd.DataFrame: types_mapping: dict[str, DataType] = { - "radio": "categorical", + "radio": "enum", "number": "number", "text": "string", "date_dmy": "date", - "checkbox": "categorical", - "dropdown": "categorical", + "checkbox": "multiselect", + "dropdown": "enum", "datetime_dmy": "date", } arc_location = ( diff --git a/src/arcmapper/strategies.py b/src/arcmapper/strategies.py index f6f8ff8..369630d 100644 --- a/src/arcmapper/strategies.py +++ b/src/arcmapper/strategies.py @@ -58,6 +58,7 @@ def get_match_dataframe_from_similarity_matrix( "arc_variable", "arc_description", "arc_response", + "arc_type", "rank", ], data=sum( @@ -71,6 +72,7 @@ def get_match_dataframe_from_similarity_matrix( arc.iloc[k].variable, arc.iloc[k].description, arc.iloc[k].responses, + arc.iloc[k].type, j, ] for j, k in enumerate(S[i]) diff --git a/src/arcmapper/types.py b/src/arcmapper/types.py index fd3a08e..82bc5b4 100644 --- a/src/arcmapper/types.py +++ b/src/arcmapper/types.py @@ -10,7 +10,7 @@ # example: gender = [(1, "male"), (2, "female")] Responses = list[str] | list[tuple[str | int, str]] -DataType = Literal["categorical", "number", "string", "date"] +DataType = Literal["enum", "number", "string", "date", "multiselect"] class PossibleMatch(NamedTuple):