Class: Openphar::Linkers::CrossPublisherLinker
- Inherits:
-
Object
- Object
- Openphar::Linkers::CrossPublisherLinker
- Defined in:
- lib/openphar/linkers/cross_publisher_linker.rb
Overview
Links pharmacopoeia monographs across different publishers
This class identifies matching substances across pharmacopoeias (e.g., JP and Ph.Int.) by comparing CAS numbers, INN names, and chemical structures.
Constant Summary collapse
- CONFIDENCE_HIGH =
Match confidence levels
0.95- CONFIDENCE_MEDIUM =
CAS + INN match
0.80- CONFIDENCE_LOW =
CAS or INN match
0.60
Instance Attribute Summary collapse
-
#jp_data ⇒ Object
readonly
Returns the value of attribute jp_data.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#phint_data ⇒ Object
readonly
Returns the value of attribute phint_data.
Instance Method Summary collapse
-
#initialize(jp_data_path:, phint_data_path:, output_path:) ⇒ CrossPublisherLinker
constructor
A new instance of CrossPublisherLinker.
-
#run ⇒ Hash
Run the linking process.
Constructor Details
#initialize(jp_data_path:, phint_data_path:, output_path:) ⇒ CrossPublisherLinker
Returns a new instance of CrossPublisherLinker.
23 24 25 26 27 28 29 30 31 |
# File 'lib/openphar/linkers/cross_publisher_linker.rb', line 23 def initialize(jp_data_path:, phint_data_path:, output_path:) @jp_data_path = jp_data_path @phint_data_path = phint_data_path @output_path = output_path @jp_monographs = [] @phint_monographs = [] @links = [] @stats = { total: 0, matches: 0, by_method: Hash.new(0) } end |
Instance Attribute Details
#jp_data ⇒ Object (readonly)
Returns the value of attribute jp_data.
13 14 15 |
# File 'lib/openphar/linkers/cross_publisher_linker.rb', line 13 def jp_data @jp_data end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
13 14 15 |
# File 'lib/openphar/linkers/cross_publisher_linker.rb', line 13 def output_path @output_path end |
#phint_data ⇒ Object (readonly)
Returns the value of attribute phint_data.
13 14 15 |
# File 'lib/openphar/linkers/cross_publisher_linker.rb', line 13 def phint_data @phint_data end |
Instance Method Details
#run ⇒ Hash
Run the linking process
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/openphar/linkers/cross_publisher_linker.rb', line 35 def run puts "Starting cross-publisher linking..." puts " JP data: #{@jp_data_path}" puts " Ph.Int. data: #{@phint_data_path}" # Load data load_data # Build indices for efficient lookup build_indices # Find matches find_matches # Generate output generate_links_file # Print statistics print_statistics @stats end |