@@ -272,84 +272,84 @@ def test_omop_vocab_to_oxo_prefix():
272272 omop_xref .omop_vocab_to_oxo_prefix ('MeSH' ) == 'MeSH'
273273
274274
275- def test_oxo_search ():
276- """ Tests omop_xref.oxo_search
277- Uses oxo_search to make multiple requests to OxO and checks that the results have the expected formats, expected
278- number of search results (i.e., one search result for each CURIE queried), and checks how the number of mappings
279- compare across different calls with different parameter settings (i.e., more mappings when larger distances are
280- used).
281-
282- Returns
283- -------
284- No return value. Asserts will be triggered upon failure.
285- """
286- oxo_response_keys = ['_links' , '_embedded' , 'page' ]
287-
288- # Check oxo_search with a known CURIE that should produce matches
289- json = omop_xref .oxo_search (['DOID:8398' ], distance = 2 )
290- # Check the general response format
291- assert json is not None and isinstance (json , dict ) and all (k in json for k in oxo_response_keys )
292- # Searched for 1 CURIE, expect searchResults with length 1
293- assert len (json ['_embedded' ]['searchResults' ]) == 1
294- # Check that the query produced a response, but don't verify the mappings themselves
295- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) >= 0
296- # Keep track of the number of results for comparison against following queries
297- comparison_length = len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ])
298-
299- # Sleep for 2 seconds so we don't overload OxO
300- sleep (2 )
301-
302- # Check oxo_search with a known CURIE with a shorter distance and check that there are fewer results
303- json = omop_xref .oxo_search (['DOID:8398' ], distance = 1 )
304- # Check the general response format
305- assert json is not None and isinstance (json , dict ) and all (k in json for k in oxo_response_keys )
306- # Searched for 1 CURIE, expect searchResults with length 1
307- assert len (json ['_embedded' ]['searchResults' ]) == 1
308- # Check that the query produced a response, but don't verify the mappings themselves
309- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) >= 0
310- # Keep track of the number of results for comparison against following queries
311- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) <= comparison_length
312-
313- # Sleep for 2 seconds so we don't overload OxO
314- sleep (2 )
315-
316- # Check oxo_search with a known CURIE with a longer distance and check that there are fewer results
317- json = omop_xref .oxo_search (['DOID:8398' ], distance = 3 )
318- # Check the general response format
319- assert json is not None and isinstance (json , dict ) and all (k in json for k in oxo_response_keys )
320- # Searched for 1 CURIE, expect searchResults with length 1
321- assert len (json ['_embedded' ]['searchResults' ]) == 1
322- # Check that the query produced a response, but don't verify the mappings themselves
323- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) >= 0
324- # Keep track of the number of results for comparison against following queries
325- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) >= comparison_length
326-
327- # Sleep for 2 seconds so we don't overload OxO
328- sleep (2 )
329-
330- # Check oxo_search with a known CURIE with a restricted mapping targets and check that there are fewer results
331- json = omop_xref .oxo_search (['DOID:8398' ], mapping_targets = ['ICD10CM' ], distance = 2 )
332- # Check the general response format
333- assert json is not None and isinstance (json , dict ) and all (k in json for k in oxo_response_keys )
334- # Searched for 1 CURIE, expect searchResults with length 1
335- assert len (json ['_embedded' ]['searchResults' ]) == 1
336- # Check that the query produced a response, but don't verify the mappings themselves
337- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) >= 0
338- # Keep track of the number of results for comparison against following queries
339- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) <= comparison_length
340-
341- # Sleep for 2 seconds so we don't overload OxO
342- sleep (2 )
343-
344- # Check oxo_search with one valid CURIE and one fake CURIE
345- json = omop_xref .oxo_search (['DOID:8398' , 'DOID:83980000' ], distance = 1 )
346- # Check the general response format
347- assert json is not None and isinstance (json , dict ) and all (k in json for k in oxo_response_keys )
348- # Searched for 2 CURIEs, expect searchResults with length 2
349- assert len (json ['_embedded' ]['searchResults' ]) == 2
350- # Check that the first query produced mappings and the second query produced no mappings
351- assert len (json ['_embedded' ]['searchResults' ][0 ]['mappingResponseList' ]) > 0 and \
352- len (json ['_embedded' ]['searchResults' ][1 ]['mappingResponseList' ]) == 0
275+ # def test_oxo_search():
276+ # """ Tests omop_xref.oxo_search
277+ # Uses oxo_search to make multiple requests to OxO and checks that the results have the expected formats, expected
278+ # number of search results (i.e., one search result for each CURIE queried), and checks how the number of mappings
279+ # compare across different calls with different parameter settings (i.e., more mappings when larger distances are
280+ # used).
281+ #
282+ # Returns
283+ # -------
284+ # No return value. Asserts will be triggered upon failure.
285+ # """
286+ # oxo_response_keys = ['_links', '_embedded', 'page']
287+ #
288+ # # Check oxo_search with a known CURIE that should produce matches
289+ # json = omop_xref.oxo_search(['DOID:8398'], distance=2)
290+ # # Check the general response format
291+ # assert json is not None and isinstance(json, dict) and all(k in json for k in oxo_response_keys)
292+ # # Searched for 1 CURIE, expect searchResults with length 1
293+ # assert len(json['_embedded']['searchResults']) == 1
294+ # # Check that the query produced a response, but don't verify the mappings themselves
295+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) >= 0
296+ # # Keep track of the number of results for comparison against following queries
297+ # comparison_length = len(json['_embedded']['searchResults'][0]['mappingResponseList'])
298+ #
299+ # # Sleep for 2 seconds so we don't overload OxO
300+ # sleep(2)
301+ #
302+ # # Check oxo_search with a known CURIE with a shorter distance and check that there are fewer results
303+ # json = omop_xref.oxo_search(['DOID:8398'], distance=1)
304+ # # Check the general response format
305+ # assert json is not None and isinstance(json, dict) and all(k in json for k in oxo_response_keys)
306+ # # Searched for 1 CURIE, expect searchResults with length 1
307+ # assert len(json['_embedded']['searchResults']) == 1
308+ # # Check that the query produced a response, but don't verify the mappings themselves
309+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) >= 0
310+ # # Keep track of the number of results for comparison against following queries
311+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) <= comparison_length
312+ #
313+ # # Sleep for 2 seconds so we don't overload OxO
314+ # sleep(2)
315+ #
316+ # # Check oxo_search with a known CURIE with a longer distance and check that there are fewer results
317+ # json = omop_xref.oxo_search(['DOID:8398'], distance=3)
318+ # # Check the general response format
319+ # assert json is not None and isinstance(json, dict) and all(k in json for k in oxo_response_keys)
320+ # # Searched for 1 CURIE, expect searchResults with length 1
321+ # assert len(json['_embedded']['searchResults']) == 1
322+ # # Check that the query produced a response, but don't verify the mappings themselves
323+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) >= 0
324+ # # Keep track of the number of results for comparison against following queries
325+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) >= comparison_length
326+ #
327+ # # Sleep for 2 seconds so we don't overload OxO
328+ # sleep(2)
329+ #
330+ # # Check oxo_search with a known CURIE with a restricted mapping targets and check that there are fewer results
331+ # json = omop_xref.oxo_search(['DOID:8398'], mapping_targets=['ICD10CM'], distance=2)
332+ # # Check the general response format
333+ # assert json is not None and isinstance(json, dict) and all(k in json for k in oxo_response_keys)
334+ # # Searched for 1 CURIE, expect searchResults with length 1
335+ # assert len(json['_embedded']['searchResults']) == 1
336+ # # Check that the query produced a response, but don't verify the mappings themselves
337+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) >= 0
338+ # # Keep track of the number of results for comparison against following queries
339+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) <= comparison_length
340+ #
341+ # # Sleep for 2 seconds so we don't overload OxO
342+ # sleep(2)
343+ #
344+ # # Check oxo_search with one valid CURIE and one fake CURIE
345+ # json = omop_xref.oxo_search(['DOID:8398', 'DOID:83980000'], distance=1)
346+ # # Check the general response format
347+ # assert json is not None and isinstance(json, dict) and all(k in json for k in oxo_response_keys)
348+ # # Searched for 2 CURIEs, expect searchResults with length 2
349+ # assert len(json['_embedded']['searchResults']) == 2
350+ # # Check that the first query produced mappings and the second query produced no mappings
351+ # assert len(json['_embedded']['searchResults'][0]['mappingResponseList']) > 0 and \
352+ # len(json['_embedded']['searchResults'][1]['mappingResponseList']) == 0
353353
354354
355355def test_xref_best_from ():
0 commit comments