Extract Drugs
This module extracts drugs from the records.
Overview
This module extracts drugs from the records.
It utilizes the drug columns (in order) listed in the config file (config.json).
It also requires you to have the drug extraction tool installed.
command(input_fpath, target_columns)
Build the command to run the drug extraction tool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_fpath
|
str
|
path to the input file |
required |
target_columns
|
list[str] | str
|
the column(s) to search |
required |
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: the command (list) to run |
Source code in src/opendata_pipeline/extract_drugs.py
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 |
|
export_drug_output(drug_results)
Export the drug output to a file.
Source code in src/opendata_pipeline/extract_drugs.py
102 103 104 105 106 107 108 109 110 111 112 |
|
fetch_drug_search_terms()
Fetch drug search terms from the remote github repo.
Returns:
Type | Description |
---|---|
None
|
dict[str, str]: a dictionary of search terms and their tags |
Source code in src/opendata_pipeline/extract_drugs.py
23 24 25 26 27 28 29 30 31 32 33 |
|
read_drug_output(source)
Read the drug output file and yield each record.
Source code in src/opendata_pipeline/extract_drugs.py
64 65 66 67 68 69 70 |
|
run(settings)
Run the drug extraction tool.
Source code in src/opendata_pipeline/extract_drugs.py
115 116 117 118 119 120 121 122 123 124 125 |
|
run_drug_tool(config)
Run the drug extraction tool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
DataSource
|
the data source config |
required |
Returns:
Type | Description |
---|---|
list[dict[str, Any]]
|
list[dict[str, Any]]: the drug results |
Source code in src/opendata_pipeline/extract_drugs.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|