openphar 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/openphar/harmonized_type_registry.rb +46 -0
- data/lib/openphar/migrators/jp/classifier.rb +49 -0
- data/lib/openphar/migrators/jp.rb +11 -0
- data/lib/openphar/migrators/ph_int/classifier.rb +74 -0
- data/lib/openphar/migrators/ph_int.rb +11 -0
- data/lib/openphar/migrators.rb +2 -0
- data/lib/openphar/models/ahp/formulation.rb +29 -0
- data/lib/openphar/models/ahp/herbal_monograph.rb +43 -0
- data/lib/openphar/models/ahp/monograph.rb +31 -0
- data/lib/openphar/models/ahp.rb +3 -16
- data/lib/openphar/models/api/bhasma.rb +44 -0
- data/lib/openphar/models/api/dravya.rb +62 -0
- data/lib/openphar/models/api/formulation.rb +31 -0
- data/lib/openphar/models/api/monograph.rb +35 -0
- data/lib/openphar/models/api.rb +4 -20
- data/lib/openphar/models/hkcmms/monograph.rb +28 -0
- data/lib/openphar/models/hkcmms/tcm_crude_drug.rb +43 -0
- data/lib/openphar/models/hkcmms/tcm_formulation.rb +31 -0
- data/lib/openphar/models/hkcmms.rb +4 -18
- data/lib/openphar/models/jp/amino_acid.rb +17 -0
- data/lib/openphar/models/jp/biological.rb +17 -0
- data/lib/openphar/models/jp/chemical_drug.rb +17 -0
- data/lib/openphar/models/jp/crude_drug.rb +34 -0
- data/lib/openphar/models/jp/excipient.rb +19 -0
- data/lib/openphar/models/jp/formulation.rb +17 -0
- data/lib/openphar/models/jp/mineral.rb +17 -0
- data/lib/openphar/models/jp/monograph.rb +58 -0
- data/lib/openphar/models/jp/powdered_crude_drug.rb +28 -0
- data/lib/openphar/models/jp/vitamin.rb +17 -0
- data/lib/openphar/models/jp.rb +11 -12
- data/lib/openphar/models/monograph.rb +28 -0
- data/lib/openphar/models/thp/cannabis_monograph.rb +39 -0
- data/lib/openphar/models/thp/herbal_monograph.rb +33 -0
- data/lib/openphar/models/thp/monograph.rb +28 -0
- data/lib/openphar/models/thp.rb +3 -15
- data/lib/openphar/publisher_registry.rb +93 -0
- data/lib/openphar/version.rb +1 -1
- data/lib/openphar.rb +2 -0
- data/ontology/context/ahp.jsonld +20 -0
- data/ontology/context/api.jsonld +20 -0
- data/ontology/context/hkcmms.jsonld +20 -0
- data/ontology/context/jp.jsonld +20 -0
- data/ontology/context/thp.jsonld +20 -0
- data/ontology/publisher/ahp/extensions.ttl +30 -0
- data/ontology/publisher/api/extensions.ttl +38 -0
- data/ontology/publisher/hkcmms/extensions.ttl +31 -0
- data/ontology/publisher/jp/extensions.ttl +40 -0
- data/ontology/publisher/thp/extensions.ttl +28 -0
- data/shapes/ahp/monograph.ttl +28 -0
- data/shapes/api/monograph.ttl +28 -0
- data/shapes/hkcmms/monograph.ttl +28 -0
- data/shapes/jp/monograph.ttl +28 -0
- data/shapes/phint/monograph.ttl +15 -0
- data/shapes/thp/monograph.ttl +28 -0
- metadata +46 -1
|
@@ -2,25 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Openphar
|
|
4
4
|
module Models
|
|
5
|
-
# Hong Kong Chinese
|
|
6
|
-
#
|
|
7
|
-
# Contains models unique to the Hong Kong Chinese Materia Medica Standards:
|
|
8
|
-
# - Traditional Chinese Medicine monographs
|
|
9
|
-
# - Bilingual (Chinese/English) content
|
|
10
|
-
# - TCM-specific properties (nature, flavor, meridian)
|
|
11
|
-
#
|
|
12
|
-
# @example
|
|
13
|
-
# # Access HKCMMS models
|
|
14
|
-
# Openphar::Models::HKCMMS::TcmMonograph
|
|
15
|
-
#
|
|
16
|
-
# @see https://www.cmchk.org.hk/
|
|
5
|
+
# Hong Kong Chinese Materia Medica Standards (HKCMMS) specific models.
|
|
17
6
|
module HKCMMS
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# - TcmNature (thermal nature: hot/warm/neutral/cool/cold)
|
|
22
|
-
# - TcmFlavor (five flavors)
|
|
23
|
-
# - TcmMeridian (meridian tropism)
|
|
7
|
+
autoload :Monograph, "openphar/models/hkcmms/monograph"
|
|
8
|
+
autoload :TcmCrudeDrug, "openphar/models/hkcmms/tcm_crude_drug"
|
|
9
|
+
autoload :TcmFormulation, "openphar/models/hkcmms/tcm_formulation"
|
|
24
10
|
end
|
|
25
11
|
end
|
|
26
12
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Amino acid monograph.
|
|
7
|
+
#
|
|
8
|
+
class AminoAcid < Monograph
|
|
9
|
+
class << self
|
|
10
|
+
def wire_key = 'amino_acid'
|
|
11
|
+
def harmonized_type = 'AminoAcid'
|
|
12
|
+
def jsonld_type = 'JpAminoAcid'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Biological substance monograph.
|
|
7
|
+
#
|
|
8
|
+
class Biological < Monograph
|
|
9
|
+
class << self
|
|
10
|
+
def wire_key = 'biological'
|
|
11
|
+
def harmonized_type = 'BiologicalSubstance'
|
|
12
|
+
def jsonld_type = 'JpBiological'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Chemical drug monograph (substance or preparation).
|
|
7
|
+
#
|
|
8
|
+
class ChemicalDrug < Monograph
|
|
9
|
+
class << self
|
|
10
|
+
def wire_key = 'chemical_drug'
|
|
11
|
+
def harmonized_type = 'ChemicalDrug'
|
|
12
|
+
def jsonld_type = 'JpChemicalDrug'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# JP-specific crude-drug (herbal) monograph.
|
|
7
|
+
#
|
|
8
|
+
# Carries the botanical source (organism + part used) per JP's
|
|
9
|
+
# `biological_source` shape in `data-japan-pharmacopia/lib/jp_pharmacopoeia/`.
|
|
10
|
+
#
|
|
11
|
+
class CrudeDrug < Monograph
|
|
12
|
+
attribute :botanical_source, :hash, default: {}
|
|
13
|
+
attribute :parts_used, :string, collection: true, default: []
|
|
14
|
+
attribute :description, :hash, default: {}
|
|
15
|
+
attribute :identification_tests, :hash, default: {}
|
|
16
|
+
attribute :constituents, :hash, default: {}
|
|
17
|
+
|
|
18
|
+
json do
|
|
19
|
+
map 'botanicalSource', to: :botanical_source
|
|
20
|
+
map 'partsUsed', to: :parts_used
|
|
21
|
+
map 'description', to: :description
|
|
22
|
+
map 'identificationTests', to: :identification_tests
|
|
23
|
+
map 'constituents', to: :constituents
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
def wire_key = 'crude_drug'
|
|
28
|
+
def harmonized_type = 'CrudeDrug'
|
|
29
|
+
def jsonld_type = 'JpCrudeDrug'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Excipient monograph. No dedicated harmonized base class yet —
|
|
7
|
+
# excipients are an emerging category that may get a dedicated
|
|
8
|
+
# type in a future ontology revision.
|
|
9
|
+
#
|
|
10
|
+
class Excipient < Monograph
|
|
11
|
+
class << self
|
|
12
|
+
def wire_key = 'excipient'
|
|
13
|
+
def harmonized_type = nil
|
|
14
|
+
def jsonld_type = 'JpExcipient'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Formulation (finished product) monograph.
|
|
7
|
+
#
|
|
8
|
+
class Formulation < Monograph
|
|
9
|
+
class << self
|
|
10
|
+
def wire_key = 'formulation'
|
|
11
|
+
def harmonized_type = 'Formulation'
|
|
12
|
+
def jsonld_type = 'JpFormulation'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Mineral substance monograph.
|
|
7
|
+
#
|
|
8
|
+
class Mineral < Monograph
|
|
9
|
+
class << self
|
|
10
|
+
def wire_key = 'mineral'
|
|
11
|
+
def harmonized_type = 'MineralSubstance'
|
|
12
|
+
def jsonld_type = 'JpMineral'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Base class for all Japan Pharmacopoeia monographs.
|
|
7
|
+
#
|
|
8
|
+
# Carries JP-specific identity (japanese_name, english_name, category)
|
|
9
|
+
# on top of the harmonized Openphar::Models::Monograph. Concrete
|
|
10
|
+
# subclasses declare their semantic @type via class methods.
|
|
11
|
+
#
|
|
12
|
+
class Monograph < Openphar::Models::Monograph
|
|
13
|
+
attribute :japanese_name, :string
|
|
14
|
+
attribute :english_name, :string
|
|
15
|
+
attribute :category, :string
|
|
16
|
+
|
|
17
|
+
json do
|
|
18
|
+
map 'japaneseName', to: :japanese_name
|
|
19
|
+
map 'englishName', to: :english_name
|
|
20
|
+
map 'category', to: :category
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
def wire_key
|
|
25
|
+
'monograph'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def harmonized_type
|
|
29
|
+
nil
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def jsonld_type
|
|
33
|
+
'JpMonograph'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def jsonld_types
|
|
37
|
+
types = ['Monograph']
|
|
38
|
+
types << harmonized_type if harmonized_type
|
|
39
|
+
types << jsonld_type unless jsonld_type == 'Monograph'
|
|
40
|
+
types.uniq
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def neo4j_labels
|
|
44
|
+
labels = %w[Monograph JP]
|
|
45
|
+
labels << harmonized_type if harmonized_type
|
|
46
|
+
labels << name&.split('::')&.last
|
|
47
|
+
labels.compact.uniq
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def iri
|
|
52
|
+
ed = (edition || 'jp18').to_s.downcase.gsub(/[^a-z0-9]/, '-')
|
|
53
|
+
"#{Openphar.base_iri}/data/jp/#{ed}/#{monograph_id}"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# JP-specific powdered crude drug.
|
|
7
|
+
#
|
|
8
|
+
# JP distinguishes powdered crude drugs from whole crude drugs in
|
|
9
|
+
# its own monograph type — a JP-only distinction. Powdered forms
|
|
10
|
+
# have additional tests (e.g., microscopic identification) that
|
|
11
|
+
# whole crude drugs don't.
|
|
12
|
+
#
|
|
13
|
+
class PowderedCrudeDrug < CrudeDrug
|
|
14
|
+
attribute :microscopic_identification, :hash, default: {}
|
|
15
|
+
|
|
16
|
+
json do
|
|
17
|
+
map 'microscopicIdentification', to: :microscopic_identification
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class << self
|
|
21
|
+
def wire_key = 'powdered_crude_drug'
|
|
22
|
+
def harmonized_type = 'CrudeDrug'
|
|
23
|
+
def jsonld_type = 'JpPowderedCrudeDrug'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module JP
|
|
6
|
+
# Vitamin monograph.
|
|
7
|
+
#
|
|
8
|
+
class Vitamin < Monograph
|
|
9
|
+
class << self
|
|
10
|
+
def wire_key = 'vitamin'
|
|
11
|
+
def harmonized_type = 'Vitamin'
|
|
12
|
+
def jsonld_type = 'JpVitamin'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/openphar/models/jp.rb
CHANGED
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
module Openphar
|
|
4
4
|
module Models
|
|
5
5
|
# Japan Pharmacopoeia (JP) specific models.
|
|
6
|
-
#
|
|
7
|
-
# Contains models unique to the Japanese Pharmacopoeia:
|
|
8
|
-
# - Kampo formulas (Japanese traditional medicine formulations)
|
|
9
|
-
# - JP-specific monograph extensions
|
|
10
|
-
#
|
|
11
|
-
# @example
|
|
12
|
-
# # Access JP models
|
|
13
|
-
# Openphar::Models::JP::KampoFormula
|
|
14
|
-
#
|
|
15
|
-
# @see https://www.mhlw.go.jp/topics/bukyoku/iyaku/yakkyoku/
|
|
16
6
|
module JP
|
|
17
|
-
|
|
18
|
-
autoload :
|
|
7
|
+
autoload :KampoFormula, "openphar/models/jp/kampo_formula"
|
|
8
|
+
autoload :Monograph, "openphar/models/jp/monograph"
|
|
9
|
+
autoload :CrudeDrug, "openphar/models/jp/crude_drug"
|
|
10
|
+
autoload :PowderedCrudeDrug, "openphar/models/jp/powdered_crude_drug"
|
|
11
|
+
autoload :ChemicalDrug, "openphar/models/jp/chemical_drug"
|
|
12
|
+
autoload :Formulation, "openphar/models/jp/formulation"
|
|
13
|
+
autoload :Biological, "openphar/models/jp/biological"
|
|
14
|
+
autoload :Excipient, "openphar/models/jp/excipient"
|
|
15
|
+
autoload :Vitamin, "openphar/models/jp/vitamin"
|
|
16
|
+
autoload :AminoAcid, "openphar/models/jp/amino_acid"
|
|
17
|
+
autoload :Mineral, "openphar/models/jp/mineral"
|
|
19
18
|
end
|
|
20
19
|
end
|
|
21
20
|
end
|
|
@@ -44,6 +44,34 @@ module Openphar
|
|
|
44
44
|
def jsonld_type
|
|
45
45
|
'Monograph'
|
|
46
46
|
end
|
|
47
|
+
|
|
48
|
+
# Override in subclasses to declare the cross-publisher semantic
|
|
49
|
+
# type (e.g., "CrudeDrug", "ChemicalDrug"). Returns nil when the
|
|
50
|
+
# subclass is publisher-specific with no harmonized equivalent.
|
|
51
|
+
#
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
def harmonized_type
|
|
54
|
+
nil
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Override in subclasses to declare the publisher-specific
|
|
58
|
+
# snake_case routing key (e.g., "tcm_crude_drug", "dravya").
|
|
59
|
+
#
|
|
60
|
+
# @return [String]
|
|
61
|
+
def wire_key
|
|
62
|
+
'monograph'
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Array of types to emit in JSON-LD @type. Computed from
|
|
66
|
+
# harmonized_type + jsonld_type + the base 'Monograph'.
|
|
67
|
+
#
|
|
68
|
+
# @return [Array<String>]
|
|
69
|
+
def jsonld_types
|
|
70
|
+
types = ['Monograph']
|
|
71
|
+
types << harmonized_type if harmonized_type
|
|
72
|
+
types << jsonld_type unless jsonld_type == 'Monograph'
|
|
73
|
+
types.uniq
|
|
74
|
+
end
|
|
47
75
|
end
|
|
48
76
|
|
|
49
77
|
def iri
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module THP
|
|
6
|
+
# THP-specific cannabis monograph (Thailand legalized cannabis for
|
|
7
|
+
# medical and research use in 2018; the Thai Herbal Pharmacopoeia
|
|
8
|
+
# maintains a distinct monograph type with regulatory-specific fields).
|
|
9
|
+
#
|
|
10
|
+
class CannabisMonograph < Monograph
|
|
11
|
+
attribute :cultivar, :string
|
|
12
|
+
attribute :thc_content, :string # Δ9-THC percent by dry weight
|
|
13
|
+
attribute :cbd_content, :string # CBD percent
|
|
14
|
+
attribute :cbn_content, :string # CBN percent
|
|
15
|
+
attribute :terpene_profile, :hash, default: {}
|
|
16
|
+
attribute :cultivation_license, :string # Thai FDA license category
|
|
17
|
+
attribute :medical_use_category, :string
|
|
18
|
+
attribute :contraindications, :string, collection: true, default: []
|
|
19
|
+
|
|
20
|
+
json do
|
|
21
|
+
map 'cultivar', to: :cultivar
|
|
22
|
+
map 'thcContent', to: :thc_content
|
|
23
|
+
map 'cbdContent', to: :cbd_content
|
|
24
|
+
map 'cbnContent', to: :cbn_content
|
|
25
|
+
map 'terpeneProfile', to: :terpene_profile
|
|
26
|
+
map 'cultivationLicense', to: :cultivation_license
|
|
27
|
+
map 'medicalUseCategory', to: :medical_use_category
|
|
28
|
+
map 'contraindications', to: :contraindications
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class << self
|
|
32
|
+
def wire_key = 'cannabis_monograph'
|
|
33
|
+
def harmonized_type = 'CrudeDrug'
|
|
34
|
+
def jsonld_type = 'ThpCannabisMonograph'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module THP
|
|
6
|
+
# Standard Thai Herbal Pharmacopoeia crude drug monograph.
|
|
7
|
+
#
|
|
8
|
+
class HerbalMonograph < Monograph
|
|
9
|
+
attribute :plant_part, :string
|
|
10
|
+
attribute :botanical_description, :hash, default: {}
|
|
11
|
+
attribute :constituents, :hash, default: {}
|
|
12
|
+
attribute :uses, :string, collection: true, default: []
|
|
13
|
+
attribute :dose, :string
|
|
14
|
+
attribute :contraindications, :string, collection: true, default: []
|
|
15
|
+
|
|
16
|
+
json do
|
|
17
|
+
map 'plantPart', to: :plant_part
|
|
18
|
+
map 'botanicalDescription', to: :botanical_description
|
|
19
|
+
map 'constituents', to: :constituents
|
|
20
|
+
map 'uses', to: :uses
|
|
21
|
+
map 'dose', to: :dose
|
|
22
|
+
map 'contraindications', to: :contraindications
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class << self
|
|
26
|
+
def wire_key = 'herbal_monograph'
|
|
27
|
+
def harmonized_type = 'CrudeDrug'
|
|
28
|
+
def jsonld_type = 'ThpHerbalMonograph'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module THP
|
|
6
|
+
# Thai Herbal Pharmacopoeia monograph (base + stub).
|
|
7
|
+
#
|
|
8
|
+
# Thai-specific traditional-medicine properties are deferred; this
|
|
9
|
+
# class exists so THP records classify and serialize today.
|
|
10
|
+
#
|
|
11
|
+
class Monograph < Openphar::Models::Monograph
|
|
12
|
+
attribute :thai_name, :string
|
|
13
|
+
attribute :english_name, :string
|
|
14
|
+
|
|
15
|
+
json do
|
|
16
|
+
map 'thaiName', to: :thai_name
|
|
17
|
+
map 'englishName', to: :english_name
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class << self
|
|
21
|
+
def wire_key = 'monograph'
|
|
22
|
+
def harmonized_type = 'CrudeDrug'
|
|
23
|
+
def jsonld_type = 'ThpMonograph'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/openphar/models/thp.rb
CHANGED
|
@@ -3,22 +3,10 @@
|
|
|
3
3
|
module Openphar
|
|
4
4
|
module Models
|
|
5
5
|
# Thai Herbal Pharmacopoeia (THP) specific models.
|
|
6
|
-
#
|
|
7
|
-
# Contains models unique to the Thai Herbal Pharmacopoeia:
|
|
8
|
-
# - Thai traditional medicine monographs
|
|
9
|
-
# - Bilingual (Thai/English) content
|
|
10
|
-
# - Cannabis monographs (legal in Thailand)
|
|
11
|
-
#
|
|
12
|
-
# @example
|
|
13
|
-
# # Access THP models
|
|
14
|
-
# Openphar::Models::THP::ThaiHerbalMonograph
|
|
15
|
-
#
|
|
16
|
-
# @see http://www.fda.moph.go.th/
|
|
17
6
|
module THP
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# - CannabisMonograph (THP-specific)
|
|
7
|
+
autoload :Monograph, "openphar/models/thp/monograph"
|
|
8
|
+
autoload :HerbalMonograph, "openphar/models/thp/herbal_monograph"
|
|
9
|
+
autoload :CannabisMonograph, "openphar/models/thp/cannabis_monograph"
|
|
22
10
|
end
|
|
23
11
|
end
|
|
24
12
|
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
# Single source of truth for "which publishers are registered."
|
|
5
|
+
#
|
|
6
|
+
# Static frozen hash — adding a publisher means one edit here AND a new
|
|
7
|
+
# publisher module file. Specs verify the two stay in sync.
|
|
8
|
+
#
|
|
9
|
+
module PublisherRegistry
|
|
10
|
+
KNOWN_PUBLISHERS = {
|
|
11
|
+
"ChP" => {
|
|
12
|
+
code: "ChP",
|
|
13
|
+
label: "Chinese Pharmacopoeia",
|
|
14
|
+
module_name: "Openphar::Models::Chp",
|
|
15
|
+
editions: %w[ChP-2025 ChP-2020].freeze,
|
|
16
|
+
homepage: "https://2025.chp.org.cn".freeze,
|
|
17
|
+
}.freeze,
|
|
18
|
+
"JP" => {
|
|
19
|
+
code: "JP",
|
|
20
|
+
label: "Japanese Pharmacopoeia",
|
|
21
|
+
module_name: "Openphar::Models::JP",
|
|
22
|
+
editions: %w[JP18].freeze,
|
|
23
|
+
homepage: "https://www.mhlw.go.jp/topics/bukyoku/iyaku/yakkyoku/".freeze,
|
|
24
|
+
}.freeze,
|
|
25
|
+
"PhInt" => {
|
|
26
|
+
code: "PhInt",
|
|
27
|
+
label: "International Pharmacopoeia (WHO)",
|
|
28
|
+
module_name: "Openphar::Models::PhInt",
|
|
29
|
+
editions: %w[PhInt-13].freeze,
|
|
30
|
+
homepage: "https://www.who.int/teams/health-product-and-policy-standards/inn-and-pharmacopoeia".freeze,
|
|
31
|
+
}.freeze,
|
|
32
|
+
"AHP" => {
|
|
33
|
+
code: "AHP",
|
|
34
|
+
label: "American Herbal Pharmacopoeia",
|
|
35
|
+
module_name: "Openphar::Models::AHP",
|
|
36
|
+
editions: [].freeze,
|
|
37
|
+
homepage: "https://www.herbal-ahp.org/".freeze,
|
|
38
|
+
}.freeze,
|
|
39
|
+
"API" => {
|
|
40
|
+
code: "API",
|
|
41
|
+
label: "Ayurvedic Pharmacopoeia of India",
|
|
42
|
+
module_name: "Openphar::Models::API",
|
|
43
|
+
editions: [].freeze,
|
|
44
|
+
homepage: "https://main.ayush.gov.in/".freeze,
|
|
45
|
+
}.freeze,
|
|
46
|
+
"HKCMMS" => {
|
|
47
|
+
code: "HKCMMS",
|
|
48
|
+
label: "Hong Kong Chinese Materia Medica Standards",
|
|
49
|
+
module_name: "Openphar::Models::HKCMMS",
|
|
50
|
+
editions: [].freeze,
|
|
51
|
+
homepage: "https://www.cmchk.org.hk/".freeze,
|
|
52
|
+
}.freeze,
|
|
53
|
+
"THP" => {
|
|
54
|
+
code: "THP",
|
|
55
|
+
label: "Thai Herbal Pharmacopoeia",
|
|
56
|
+
module_name: "Openphar::Models::THP",
|
|
57
|
+
editions: [].freeze,
|
|
58
|
+
homepage: "http://www.fda.moph.go.th/".freeze,
|
|
59
|
+
}.freeze,
|
|
60
|
+
}.freeze
|
|
61
|
+
|
|
62
|
+
class << self
|
|
63
|
+
def all
|
|
64
|
+
KNOWN_PUBLISHERS
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def [](code)
|
|
68
|
+
KNOWN_PUBLISHERS[code.to_s]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def registered?(code)
|
|
72
|
+
KNOWN_PUBLISHERS.key?(code.to_s)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def codes
|
|
76
|
+
KNOWN_PUBLISHERS.keys.sort
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def module_for(code)
|
|
80
|
+
entry = self[code]
|
|
81
|
+
return nil unless entry
|
|
82
|
+
|
|
83
|
+
entry[:module_name].safe_constantize
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
module_function
|
|
89
|
+
|
|
90
|
+
def publishers
|
|
91
|
+
PublisherRegistry.all
|
|
92
|
+
end
|
|
93
|
+
end
|
data/lib/openphar/version.rb
CHANGED
data/lib/openphar.rb
CHANGED
|
@@ -112,4 +112,6 @@ module Openphar
|
|
|
112
112
|
autoload :Errors, 'openphar/errors'
|
|
113
113
|
autoload :MonographMerger, 'openphar/monograph_merger'
|
|
114
114
|
autoload :Registry, 'openphar/registry'
|
|
115
|
+
autoload :PublisherRegistry, 'openphar/publisher_registry'
|
|
116
|
+
autoload :HarmonizedTypeRegistry, 'openphar/harmonized_type_registry'
|
|
115
117
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"@version": 1.1,
|
|
4
|
+
"@base": "https://www.openphar.org/data/ahp/",
|
|
5
|
+
"@vocab": "https://www.openphar.org/ontology/publisher/ahp/",
|
|
6
|
+
"ahp": "https://www.openphar.org/ontology/publisher/ahp/",
|
|
7
|
+
"op": "https://www.openphar.org/ontology/core/",
|
|
8
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
9
|
+
"dct": "http://purl.org/dc/terms/",
|
|
10
|
+
"skos": "http://www.w3.org/2004/02/skos/core#",
|
|
11
|
+
"id": "@id",
|
|
12
|
+
"type": "@type",
|
|
13
|
+
"title": "dct:title",
|
|
14
|
+
"prefLabel": "skos:prefLabel",
|
|
15
|
+
"publisher": "dct:publisher",
|
|
16
|
+
"monographId": { "@id": "op:monographId", "@type": "xsd:string" },
|
|
17
|
+
"belongsToEdition": { "@id": "op:belongsToEdition", "@type": "@id" },
|
|
18
|
+
"sameSubstanceAs": { "@id": "op:sameSubstanceAs", "@type": "@id", "@container": "@set" }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"@version": 1.1,
|
|
4
|
+
"@base": "https://www.openphar.org/data/api/",
|
|
5
|
+
"@vocab": "https://www.openphar.org/ontology/publisher/api/",
|
|
6
|
+
"api": "https://www.openphar.org/ontology/publisher/api/",
|
|
7
|
+
"op": "https://www.openphar.org/ontology/core/",
|
|
8
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
9
|
+
"dct": "http://purl.org/dc/terms/",
|
|
10
|
+
"skos": "http://www.w3.org/2004/02/skos/core#",
|
|
11
|
+
"id": "@id",
|
|
12
|
+
"type": "@type",
|
|
13
|
+
"title": "dct:title",
|
|
14
|
+
"prefLabel": "skos:prefLabel",
|
|
15
|
+
"publisher": "dct:publisher",
|
|
16
|
+
"monographId": { "@id": "op:monographId", "@type": "xsd:string" },
|
|
17
|
+
"belongsToEdition": { "@id": "op:belongsToEdition", "@type": "@id" },
|
|
18
|
+
"sameSubstanceAs": { "@id": "op:sameSubstanceAs", "@type": "@id", "@container": "@set" }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": {
|
|
3
|
+
"@version": 1.1,
|
|
4
|
+
"@base": "https://www.openphar.org/data/hkcmms/",
|
|
5
|
+
"@vocab": "https://www.openphar.org/ontology/publisher/hkcmms/",
|
|
6
|
+
"hkcmms": "https://www.openphar.org/ontology/publisher/hkcmms/",
|
|
7
|
+
"op": "https://www.openphar.org/ontology/core/",
|
|
8
|
+
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
9
|
+
"dct": "http://purl.org/dc/terms/",
|
|
10
|
+
"skos": "http://www.w3.org/2004/02/skos/core#",
|
|
11
|
+
"id": "@id",
|
|
12
|
+
"type": "@type",
|
|
13
|
+
"title": "dct:title",
|
|
14
|
+
"prefLabel": "skos:prefLabel",
|
|
15
|
+
"publisher": "dct:publisher",
|
|
16
|
+
"monographId": { "@id": "op:monographId", "@type": "xsd:string" },
|
|
17
|
+
"belongsToEdition": { "@id": "op:belongsToEdition", "@type": "@id" },
|
|
18
|
+
"sameSubstanceAs": { "@id": "op:sameSubstanceAs", "@type": "@id", "@container": "@set" }
|
|
19
|
+
}
|
|
20
|
+
}
|