From 0f7c2b11a052c8f6a2b8eb12c47756d0472efc99 Mon Sep 17 00:00:00 2001 From: AlexNikic Date: Thu, 10 Apr 2025 10:59:23 +0100 Subject: [PATCH 1/2] response options now sending --- .gitmodules | 7 +++---- harmony | 2 +- harmony_api/routers/text_router.py | 7 +++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index 048708b..03d9d8d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,7 @@ -[submodule "harmony"] - path = harmony - url = https://github.com/harmonydata/harmony.git - branch = catalogue-match-instruments [submodule "mhc_embeddings"] path = mhc_embeddings url = https://github.com/harmonydata/mhc_embeddings.git branch = main +[submodule "harmony"] + path = harmony + url = https://github.com/AlexNikic/harmony.git diff --git a/harmony b/harmony index 5d11c9a..8587729 160000 --- a/harmony +++ b/harmony @@ -1 +1 @@ -Subproject commit 5d11c9a260a21b0caa947e5b4771df273078ef87 +Subproject commit 85877293a9bd34385139cc5b3c3bf1f5ff5b64ab diff --git a/harmony_api/routers/text_router.py b/harmony_api/routers/text_router.py index 4c0ca19..164e109 100644 --- a/harmony_api/routers/text_router.py +++ b/harmony_api/routers/text_router.py @@ -189,7 +189,6 @@ def parse_instruments( return instruments - @router.post( path="/match", response_model=MatchResponse, status_code=status.HTTP_200_OK, response_model_exclude_none=True ) @@ -299,6 +298,9 @@ def match( else: query_similarity = None + # Response options similarity + response_options_similarity = match_response_from_library.response_options_similarity.tolist() + return MatchResponse( instruments=instruments, questions=match_response_from_library.questions, @@ -306,7 +308,8 @@ def match( query_similarity=query_similarity, closest_catalogue_instrument_matches=closest_catalogue_instrument_matches, instrument_to_instrument_similarities=match_response_from_library.instrument_to_instrument_similarities, - clusters=match_response_from_library.clusters + clusters=match_response_from_library.clusters, + response_options_similarity=response_options_similarity ) From 7ae7ad5c0dfe5bc57c8f7ee99f1587e5468ec654 Mon Sep 17 00:00:00 2001 From: AlexNikic Date: Thu, 10 Apr 2025 12:16:04 +0100 Subject: [PATCH 2/2] changed tests to work --- tests/local_tests/test_match_local.py | 2 +- tests/local_tests/test_match_local_bigger.py | 2 +- tests/local_tests/test_negate_local.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/local_tests/test_match_local.py b/tests/local_tests/test_match_local.py index 8d894df..2bc09ed 100644 --- a/tests/local_tests/test_match_local.py +++ b/tests/local_tests/test_match_local.py @@ -123,7 +123,7 @@ class TestMatch(unittest.TestCase): def test_gad_7_correct_size_dictionary_response(self): - self.assertEqual(7, len(response.json())) + self.assertEqual(8, len(response.json())) def test_gad_7_first_question_conserved(self): self.assertEqual("Feeling nervous, anxious, or on edge", response.json()["questions"][0]["question_text"]) diff --git a/tests/local_tests/test_match_local_bigger.py b/tests/local_tests/test_match_local_bigger.py index a116bde..88854ea 100644 --- a/tests/local_tests/test_match_local_bigger.py +++ b/tests/local_tests/test_match_local_bigger.py @@ -1477,7 +1477,7 @@ class TestMatchBiggerPayload(unittest.TestCase): def test_big_match_command(self): - self.assertEqual(7, len(response.json())) + self.assertEqual(8, len(response.json())) if __name__ == '__main__': diff --git a/tests/local_tests/test_negate_local.py b/tests/local_tests/test_negate_local.py index 571d959..f892769 100644 --- a/tests/local_tests/test_negate_local.py +++ b/tests/local_tests/test_negate_local.py @@ -62,7 +62,7 @@ class TestMatch(unittest.TestCase): def test_negation_instrument_correct_size_dictionary_response(self): - self.assertEqual(7, len(response.json())) + self.assertEqual(8, len(response.json())) def test_negation_instrument_first_question_conserved(self): self.assertEqual("I feel nervous", response.json()["questions"][0]["question_text"])