Skip to content

Commit 424d75a

Browse files
authored
Merge pull request #20 from AlexNikic/main
Added response options similarity matrix
2 parents 1ef98e0 + 7ae7ad5 commit 424d75a

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

.gitmodules

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
[submodule "harmony"]
2-
path = harmony
3-
url = https://github.com/harmonydata/harmony.git
4-
branch = catalogue-match-instruments
51
[submodule "mhc_embeddings"]
62
path = mhc_embeddings
73
url = https://github.com/harmonydata/mhc_embeddings.git
84
branch = main
5+
[submodule "harmony"]
6+
path = harmony
7+
url = https://github.com/AlexNikic/harmony.git

harmony_api/routers/text_router.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ def parse_instruments(
189189
return instruments
190190

191191

192-
193192
@router.post(
194193
path="/match", response_model=MatchResponse, status_code=status.HTTP_200_OK, response_model_exclude_none=True
195194
)
@@ -299,14 +298,18 @@ def match(
299298
else:
300299
query_similarity = None
301300

301+
# Response options similarity
302+
response_options_similarity = match_response_from_library.response_options_similarity.tolist()
303+
302304
return MatchResponse(
303305
instruments=instruments,
304306
questions=match_response_from_library.questions,
305307
matches=matches_jsonable,
306308
query_similarity=query_similarity,
307309
closest_catalogue_instrument_matches=closest_catalogue_instrument_matches,
308310
instrument_to_instrument_similarities=match_response_from_library.instrument_to_instrument_similarities,
309-
clusters=match_response_from_library.clusters
311+
clusters=match_response_from_library.clusters,
312+
response_options_similarity=response_options_similarity
310313
)
311314

312315

tests/local_tests/test_match_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
class TestMatch(unittest.TestCase):
124124

125125
def test_gad_7_correct_size_dictionary_response(self):
126-
self.assertEqual(7, len(response.json()))
126+
self.assertEqual(8, len(response.json()))
127127

128128
def test_gad_7_first_question_conserved(self):
129129
self.assertEqual("Feeling nervous, anxious, or on edge", response.json()["questions"][0]["question_text"])

tests/local_tests/test_match_local_bigger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@
14771477
class TestMatchBiggerPayload(unittest.TestCase):
14781478

14791479
def test_big_match_command(self):
1480-
self.assertEqual(7, len(response.json()))
1480+
self.assertEqual(8, len(response.json()))
14811481

14821482

14831483
if __name__ == '__main__':

tests/local_tests/test_negate_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
class TestMatch(unittest.TestCase):
6363

6464
def test_negation_instrument_correct_size_dictionary_response(self):
65-
self.assertEqual(7, len(response.json()))
65+
self.assertEqual(8, len(response.json()))
6666

6767
def test_negation_instrument_first_question_conserved(self):
6868
self.assertEqual("I feel nervous", response.json()["questions"][0]["question_text"])

0 commit comments

Comments
 (0)