Skip to content

Commit ebdba7c

Browse files
author
alex-omophub
committed
Examples update
1 parent 680059c commit ebdba7c

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

examples/map_between_vocabularies.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def get_mappings() -> None:
1616

1717
result = client.mappings.get(
1818
concept_id,
19-
target_vocabularies=["ICD10CM", "Read", "ICD9CM"],
20-
include_mapping_quality=True,
19+
target_vocabulary="ICD10CM",
2120
)
2221

2322
source = result.get("source_concept", {})
@@ -32,12 +31,8 @@ def get_mappings() -> None:
3231
target_vocab = m.get("target_vocabulary_id", "?")
3332
target_code = m.get("target_concept_code", "?")
3433
target_name = m.get("target_concept_name", "?")
35-
# Access confidence via quality when available
36-
quality = m.get("quality", {})
37-
confidence = quality.get("confidence_score", "N/A") if quality else "N/A"
3834
print(f"\n [{target_vocab}] {target_code}")
3935
print(f" Name: {target_name}")
40-
print(f" Confidence: {confidence}")
4136
except omophub.OMOPHubError as e:
4237
print(f"API error: {e.message}")
4338
finally:
@@ -89,14 +84,11 @@ def lookup_by_code() -> None:
8984
print(f" Vocabulary: {concept.get('vocabulary_id', 'Unknown')}")
9085
print(f" Standard: {concept.get('standard_concept', 'N/A')}")
9186

92-
# If it's not a standard concept, find mappings to standard concepts
87+
# If it's not a standard concept, find mappings
9388
if concept.get("standard_concept") != "S":
94-
mappings = client.mappings.get(
95-
concept.get("concept_id", 0),
96-
standard_only=True,
97-
)
89+
mappings = client.mappings.get(concept.get("concept_id", 0))
9890

99-
print("\n Standard mappings:")
91+
print("\n Mappings to other vocabularies:")
10092
for m in mappings.get("mappings", [])[:5]:
10193
print(f" → {m.get('target_concept_name', 'Unknown')}")
10294
except omophub.OMOPHubError as e:

examples/navigate_hierarchy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def explore_relationships() -> None:
5959
# Aspirin
6060
concept_id = 1112807
6161

62-
result = client.concepts.relationships(concept_id, page_size=20)
62+
result = client.concepts.relationships(concept_id)
6363

6464
relationships = result.get("relationships", result)
6565
summary = result.get("relationship_summary", {})

examples/search_concepts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def autocomplete_example() -> None:
5656
print("\n=== Autocomplete ===")
5757

5858
# Get suggestions as user types
59-
suggestions = client.concepts.suggest("hypert", limit=5)
59+
suggestions = client.concepts.suggest("hypert", page_size=5)
6060

6161
print("Suggestions for 'hypert':")
6262
for s in suggestions[:5]:

0 commit comments

Comments
 (0)