term_cleaner
TermCleaner
A class to clean clinical terms by removing non-essential modifiers and information using a Large Language Model (LLM).
Source code in src/ariadne/term_cleanup/term_cleaner.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
clean_term(term)
Cleans a clinical term using an LLM to remove non-essential modifiers and information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
term
|
str
|
The clinical term to be cleaned. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The cleaned clinical term. |
Source code in src/ariadne/term_cleanup/term_cleaner.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
clean_terms(df, term_column='source_term', output_column='cleaned_term')
Cleans clinical terms in a DataFrame column using the LLM.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame containing the terms to be cleaned. |
required |
term_column
|
str
|
Name of the column with terms to be cleaned. |
'source_term'
|
output_column
|
str
|
Name of the column to store cleaned terms. |
'cleaned_term'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with an additional column for cleaned terms. |
Source code in src/ariadne/term_cleanup/term_cleaner.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
get_total_cost()
Returns the total cost incurred for LLM calls during term cleaning.
Returns:
| Type | Description |
|---|---|
float
|
Total cost in USD. |
Source code in src/ariadne/term_cleanup/term_cleaner.py
80 81 82 83 84 85 86 87 88 | |