Class: Openphar::Models::Publisher

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/openphar/models/publisher.rb

Overview

Represents a pharmacopoeia publisher

Constant Summary collapse

PUBLISHERS =

Publisher registry

{
  'JP' => {
    code: 'JP',
    name: { 'en' => 'Japanese Pharmacopoeia', 'ja' => '日本薬局方' },
    country: 'JP',
    url: 'https://www.mhlw.go.jp/topics/bukyoku/iyaku/yakkyoku/'
  },
  'PhInt' => {
    code: 'PhInt',
    name: { 'en' => 'International Pharmacopoeia', 'fr' => 'Pharmacopée Internationale' },
    country: 'INT',
    url: 'https://www.who.int/teams/health-product-and-policy-standards/inn-and-pharmacopoeia'
  },
  'API' => {
    code: 'API',
    name: { 'en' => 'Ayurvedic Pharmacopoeia of India' },
    country: 'IN',
    url: 'https://main.ayush.gov.in/'
  },
  'HKCMMS' => {
    code: 'HKCMMS',
    name: { 'en' => 'Hong Kong Chinese Materia Medica Standards', 'zh-Hant' => '香港中藥材標準' },
    country: 'HK',
    url: 'https://www.cmms.org.hk/'
  },
  'THP' => {
    code: 'THP',
    name: { 'en' => 'Thai Herbal Pharmacopoeia', 'th' => 'ตำรายาจารีกสมุนไพร' },
    country: 'TH',
    url: 'https://www.fda.moph.go.th/'
  },
  'AHP' => {
    code: 'AHP',
    name: { 'en' => 'American Herbal Pharmacopoeia' },
    country: 'US',
    url: 'https://www.herbal-ahp.org/'
  },
  'WHO' => {
    code: 'WHO',
    name: { 'en' => 'WHO Monographs on Selected Medicinal Plants' },
    country: 'INT',
    url: 'https://www.who.int/'
  }
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject

Returns all publishers



83
84
85
# File 'lib/openphar/models/publisher.rb', line 83

def all
  PUBLISHERS.keys.map { |code| find(code) }
end

.find(code) ⇒ Object

Find a publisher by code



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/openphar/models/publisher.rb', line 69

def find(code)
  return nil unless PUBLISHERS.key?(code)

  data = PUBLISHERS[code]
  new(
    id: code,
    code: data[:code],
    name: data[:name],
    country: data[:country],
    url: data[:url]
  )
end

.iri(code) ⇒ Object

Returns the IRI for a publisher



88
89
90
# File 'lib/openphar/models/publisher.rb', line 88

def iri(code)
  "#{Openphar.base_iri}/ontology/core/#{code}"
end

Instance Method Details

#iriObject



93
94
95
# File 'lib/openphar/models/publisher.rb', line 93

def iri
  self.class.iri(code)
end