@@ -49,6 +49,54 @@ def test_search_with_domain_filter(self, integration_client: OMOPHub) -> None:
4949 for concept in concepts :
5050 assert concept .get ("domain_id" ) == "Drug"
5151
52+ def test_search_with_standard_concept_filter (
53+ self , integration_client : OMOPHub
54+ ) -> None :
55+ """Search for standard concepts only."""
56+ results = integration_client .search .basic (
57+ "diabetes" ,
58+ standard_concept = "S" ,
59+ page_size = 20 ,
60+ )
61+
62+ concepts = extract_data (results , "concepts" )
63+ assert len (concepts ) > 0
64+ # All results should be standard concepts
65+ for concept in concepts :
66+ assert concept .get ("standard_concept" ) == "S"
67+
68+ def test_search_with_multiple_filters_and_pagination (
69+ self , integration_client : OMOPHub
70+ ) -> None :
71+ """Search with multiple filters to test COUNT query parameter binding.
72+
73+ This test specifically catches COUNT query bugs where parameter binding
74+ differs between the main query and the count query. If the COUNT query
75+ fails (like with missing standard_concept parameter), the API would
76+ return a 500 error instead of results.
77+ """
78+ results = integration_client .search .basic (
79+ "diabetes" ,
80+ vocabulary_ids = ["SNOMED" ],
81+ domain_ids = ["Condition" ],
82+ standard_concept = "S" ,
83+ page_size = 10 ,
84+ )
85+
86+ # Extract concepts - SDK may return list directly or wrapped in dict
87+ concepts = extract_data (results , "concepts" )
88+ assert len (concepts ) > 0 , "Expected concepts but got empty result"
89+
90+ # Verify all filters applied correctly
91+ for concept in concepts :
92+ assert concept .get ("vocabulary_id" ) == "SNOMED"
93+ assert concept .get ("domain_id" ) == "Condition"
94+ assert concept .get ("standard_concept" ) == "S"
95+
96+ # Note: The SDK extracts concepts from the response, so we verify
97+ # the COUNT query worked by the fact that we got results without
98+ # an error (COUNT query failure would cause HTTP 500)
99+
52100 def test_autocomplete (self , integration_client : OMOPHub ) -> None :
53101 """Test autocomplete suggestions."""
54102 result = integration_client .search .autocomplete (
0 commit comments