Skip to content

Commit 322ecd5

Browse files
author
alex-omophub
committed
Release version 1.5.0 with new bulk search features
1 parent 7fda72c commit 322ecd5

4 files changed

Lines changed: 135 additions & 1 deletion

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: omophub
22
Title: R Client for the 'OMOPHub' Medical Vocabulary API
3-
Version: 1.4.0
3+
Version: 1.5.0
44
Authors@R: c(
55
person("Alex", "Chen", email = "alex@omophub.com", role = c("aut", "cre", "cph")),
66
person("Observational Health Data Science and Informatics", role = c("cph"))

NEWS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# omophub 1.5.0
2+
3+
## New Features
4+
5+
* **Bulk lexical search** (`bulk_basic()`): Execute up to 50 keyword searches
6+
in a single API call. Supports shared default filters for vocabulary, domain,
7+
and other parameters. Each search is identified by a unique `search_id` for
8+
result matching. Maps to `POST /v1/search/bulk`.
9+
10+
* **Bulk semantic search** (`bulk_semantic()`): Execute up to 25 natural-language
11+
searches using neural embeddings in a single call. Supports per-search
12+
similarity thresholds and shared defaults. Query length validated at 1-500
13+
characters. Maps to `POST /v1/search/semantic-bulk`.
14+
115
# omophub 1.4.0
216

317
## New Features

inst/examples/search_concepts.R

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,79 @@ for (s in similar$similar_concepts) {
276276
}
277277
cat("\n")
278278

279+
# ============================================================================
280+
# Bulk Lexical Search
281+
# ============================================================================
282+
283+
cat("11. Bulk lexical search (multiple queries in one call)\n")
284+
cat("------------------------------------------------------\n")
285+
286+
# Search for multiple terms at once (up to 50)
287+
results <- client$search$bulk_basic(list(
288+
list(search_id = "q1", query = "diabetes mellitus"),
289+
list(search_id = "q2", query = "hypertension"),
290+
list(search_id = "q3", query = "aspirin")
291+
), defaults = list(vocabulary_ids = list("SNOMED"), page_size = 3))
292+
293+
cat("Bulk search results:\n")
294+
for (item in results$results) {
295+
cat(sprintf(" %s: %d results (%s)\n",
296+
item$search_id, length(item$results), item$status))
297+
}
298+
cat("\n")
299+
300+
# ============================================================================
301+
# Bulk Semantic Search
302+
# ============================================================================
303+
304+
cat("12. Bulk semantic search (multiple NLP queries)\n")
305+
cat("------------------------------------------------\n")
306+
307+
# Search for multiple natural-language queries at once (up to 25)
308+
results <- client$search$bulk_semantic(list(
309+
list(search_id = "s1", query = "heart failure treatment options"),
310+
list(search_id = "s2", query = "type 2 diabetes medication"),
311+
list(search_id = "s3", query = "elevated blood pressure")
312+
), defaults = list(threshold = 0.5, page_size = 5))
313+
314+
cat("Bulk semantic results:\n")
315+
for (item in results$results) {
316+
n_results <- item$result_count %||% length(item$results)
317+
cat(sprintf(" %s: %d results (%s)\n",
318+
item$search_id, n_results, item$status))
319+
320+
# Show top result for each query
321+
if (length(item$results) > 0) {
322+
top <- item$results[[1]]
323+
cat(sprintf(" Top: %s (score: %.2f)\n",
324+
top$concept_name, top$similarity_score))
325+
}
326+
}
327+
cat("\n")
328+
329+
# ============================================================================
330+
# Bulk Search with Per-Query Overrides
331+
# ============================================================================
332+
333+
cat("13. Bulk search with per-query filters\n")
334+
cat("--------------------------------------\n")
335+
336+
# Defaults apply to all, but individual searches can override
337+
results <- client$search$bulk_basic(list(
338+
list(search_id = "conditions", query = "diabetes", domain_ids = list("Condition")),
339+
list(search_id = "drugs", query = "metformin", domain_ids = list("Drug"))
340+
), defaults = list(vocabulary_ids = list("SNOMED", "RxNorm"), page_size = 3))
341+
342+
for (item in results$results) {
343+
cat(sprintf(" %s:\n", item$search_id))
344+
for (c in item$results) {
345+
cat(sprintf(" [%d] %s (%s/%s)\n",
346+
c$concept_id, c$concept_name,
347+
c$vocabulary_id, c$domain_id))
348+
}
349+
}
350+
cat("\n")
351+
279352
# ============================================================================
280353
# Done
281354
# ============================================================================

vignettes/getting-started.Rmd

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,53 @@ similar <- client$search$similar(
188188
)
189189
```
190190

191+
## Bulk Search
192+
193+
Search for multiple queries in a single API call — much faster than individual requests when you have many terms to look up.
194+
195+
### Bulk Lexical Search
196+
197+
Execute up to 50 keyword searches at once:
198+
199+
```{r bulk-basic}
200+
results <- client$search$bulk_basic(list(
201+
list(search_id = "q1", query = "diabetes mellitus"),
202+
list(search_id = "q2", query = "hypertension"),
203+
list(search_id = "q3", query = "aspirin")
204+
), defaults = list(vocabulary_ids = list("SNOMED"), page_size = 5))
205+
206+
# Each result is matched by search_id
207+
for (item in results$results) {
208+
cat(sprintf("%s: %d results\n", item$search_id, length(item$results)))
209+
}
210+
```
211+
212+
### Bulk Semantic Search
213+
214+
Execute up to 25 natural-language searches using neural embeddings:
215+
216+
```{r bulk-semantic}
217+
results <- client$search$bulk_semantic(list(
218+
list(search_id = "s1", query = "heart failure treatment options"),
219+
list(search_id = "s2", query = "type 2 diabetes medication")
220+
), defaults = list(threshold = 0.5, page_size = 10))
221+
222+
for (item in results$results) {
223+
cat(sprintf("%s: %d results\n", item$search_id,
224+
item$result_count %||% length(item$results)))
225+
}
226+
```
227+
228+
Defaults apply to all searches; per-search values override them:
229+
230+
```{r bulk-overrides}
231+
# Different domains per query, shared vocabulary filter
232+
results <- client$search$bulk_basic(list(
233+
list(search_id = "cond", query = "diabetes", domain_ids = list("Condition")),
234+
list(search_id = "drug", query = "metformin", domain_ids = list("Drug"))
235+
), defaults = list(vocabulary_ids = list("SNOMED", "RxNorm"), page_size = 5))
236+
```
237+
191238
## Autocomplete
192239

193240
Get suggestions for autocomplete:

0 commit comments

Comments
 (0)