Skip to content

Commit db326bd

Browse files
authored
Merge pull request #1 from OMOPHub/semantic-search
Semantic search
2 parents b6c74dd + 89b8684 commit db326bd

9 files changed

Lines changed: 1132 additions & 11 deletions

File tree

.github/FUNDING.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, master, develop]
66
pull_request:
7-
branches: [main]
7+
branches: [main, master, develop]
8+
workflow_dispatch: # Allow manual triggering
89

910
jobs:
1011
lint:
@@ -52,6 +53,8 @@ jobs:
5253
token: ${{ secrets.CODECOV_TOKEN }}
5354

5455
integration:
56+
# Only run on push to main/develop, not on PRs (saves ~7-8 min per PR)
57+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
5558
runs-on: ubuntu-latest
5659
steps:
5760
- uses: actions/checkout@v4

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,29 @@ mappings = client.mappings.get_by_code("ICD10CM", "E11.9", target_vocabulary="SN
5858
ancestors = client.hierarchy.ancestors(201826, max_levels=3)
5959
```
6060

61+
## Semantic Search
62+
63+
Use natural language queries to find concepts using neural embeddings:
64+
65+
```python
66+
# Natural language search - understands clinical intent
67+
results = client.search.semantic("high blood sugar levels")
68+
for r in results["results"]:
69+
print(f"{r['concept_name']} (similarity: {r['similarity_score']:.2f})")
70+
71+
# Filter by vocabulary and set minimum similarity threshold
72+
results = client.search.semantic(
73+
"heart attack",
74+
vocabulary_ids=["SNOMED"],
75+
domain_ids=["Condition"],
76+
threshold=0.5
77+
)
78+
79+
# Iterate through all results with auto-pagination
80+
for result in client.search.semantic_iter("chronic kidney disease", page_size=50):
81+
print(f"{result['concept_id']}: {result['concept_name']}")
82+
```
83+
6184
## Async Support
6285

6386
```python
@@ -130,7 +153,7 @@ suggestions = client.concepts.suggest("diab", vocabulary_ids=["SNOMED"], page_si
130153
| Resource | Description | Key Methods |
131154
|----------|-------------|-------------|
132155
| `concepts` | Concept lookup and batch operations | `get()`, `get_by_code()`, `batch()`, `suggest()` |
133-
| `search` | Full-text and semantic search | `basic()`, `advanced()`, `semantic()`, `fuzzy()` |
156+
| `search` | Full-text and semantic search | `basic()`, `advanced()`, `semantic()`, `semantic_iter()`, `fuzzy()` |
134157
| `hierarchy` | Navigate concept relationships | `ancestors()`, `descendants()` |
135158
| `mappings` | Cross-vocabulary mappings | `get()`, `map()` |
136159
| `vocabularies` | Vocabulary metadata | `list()`, `get()`, `stats()` |

0 commit comments

Comments
 (0)