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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d35db752ba7a2c40757ca084fb31fdb95f519c1a4cdc5fca9197b6798a9b426f
|
|
4
|
+
data.tar.gz: a987b5e0709dcad7573af2e76a54c1e906a59492b9ac0cec394769448cd15880
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34a0338ab86fa45a258b3084a694242eec59ca8578960788078f3f4d3afe6c1c6e814d5117e3e3c211658c996c7bc4bd8faae6d378dd206aaea163b21a707b2b
|
|
7
|
+
data.tar.gz: 47235f7908eb73956a0f553f985c4b5fbf162589f634a3fccecdf9ea0df82a7b3edd02a1257dfebf1d2340df3bed462d1e6738f1a7c0d1b1b5946d9566519348
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
# Frozen set of recognized harmonized type names.
|
|
5
|
+
#
|
|
6
|
+
# Every publisher subclass's `harmonized_type` (when non-nil) must be in
|
|
7
|
+
# this list. Specs verify that. Catches typos at definition time.
|
|
8
|
+
#
|
|
9
|
+
module HarmonizedTypeRegistry
|
|
10
|
+
RECOGNIZED = %w[
|
|
11
|
+
Monograph
|
|
12
|
+
CrudeDrug
|
|
13
|
+
ChemicalDrug
|
|
14
|
+
Formulation
|
|
15
|
+
BiologicalSubstance
|
|
16
|
+
Vitamin
|
|
17
|
+
AminoAcid
|
|
18
|
+
MineralSubstance
|
|
19
|
+
Radiopharmaceutical
|
|
20
|
+
DosageForm
|
|
21
|
+
TestMethod
|
|
22
|
+
Reagent
|
|
23
|
+
ReferenceSubstance
|
|
24
|
+
GeneralChapter
|
|
25
|
+
].freeze
|
|
26
|
+
|
|
27
|
+
class << self
|
|
28
|
+
def valid?(type)
|
|
29
|
+
return false if type.nil?
|
|
30
|
+
|
|
31
|
+
RECOGNIZED.include?(type.to_s)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def assert!(type)
|
|
35
|
+
return if valid?(type)
|
|
36
|
+
|
|
37
|
+
raise ArgumentError, "unknown harmonized type: #{type.inspect}. " \
|
|
38
|
+
"Must be one of: #{RECOGNIZED.join(', ')}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def all
|
|
42
|
+
RECOGNIZED.dup
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Migrators
|
|
5
|
+
module JP
|
|
6
|
+
# Single dispatch point mapping a JP record's type string to the
|
|
7
|
+
# correct Openphar::Models::JP::* subclass.
|
|
8
|
+
#
|
|
9
|
+
# JP's HTML parser already produces a type string (e.g.,
|
|
10
|
+
# "CrudeDrugMonograph"); the classifier trusts it and maps to the
|
|
11
|
+
# JP-specific subclass. Falls back to JP::Monograph for unknown
|
|
12
|
+
# type strings.
|
|
13
|
+
#
|
|
14
|
+
# MECE invariant: every type string in TYPE_MAP classifies to
|
|
15
|
+
# exactly one subclass; every other input falls back to the base.
|
|
16
|
+
#
|
|
17
|
+
class Classifier
|
|
18
|
+
TYPE_MAP = {
|
|
19
|
+
'CrudeDrugMonograph' => 'CrudeDrug',
|
|
20
|
+
'ChemicalDrugMonograph' => 'ChemicalDrug',
|
|
21
|
+
'FormulationMonograph' => 'Formulation',
|
|
22
|
+
'BiologicalSubstanceMonograph' => 'Biological',
|
|
23
|
+
'VitaminMonograph' => 'Vitamin',
|
|
24
|
+
'AminoAcidMonograph' => 'AminoAcid',
|
|
25
|
+
'MineralSubstanceMonograph' => 'Mineral',
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
28
|
+
FINAL_FALLBACK = 'Monograph'.freeze
|
|
29
|
+
|
|
30
|
+
class << self
|
|
31
|
+
# @param type_string [String, nil] Harmonized type string from the parser.
|
|
32
|
+
# @param name [String, nil] Monograph name (for name-based heuristics, deferred).
|
|
33
|
+
# @return [Class] a subclass of Openphar::Models::JP::Monograph
|
|
34
|
+
def classify(type_string:, name: nil)
|
|
35
|
+
klass_name = TYPE_MAP.fetch(type_string, FINAL_FALLBACK)
|
|
36
|
+
Openphar::Models::JP.const_get(klass_name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def all_types
|
|
40
|
+
%i[CrudeDrug ChemicalDrug Formulation Biological
|
|
41
|
+
Excipient Vitamin AminoAcid Mineral].map do |k|
|
|
42
|
+
Openphar::Models::JP.const_get(k)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Migrators
|
|
5
|
+
module PhInt
|
|
6
|
+
# Single dispatch point mapping a Ph.Int. record's section_id to the
|
|
7
|
+
# correct Openphar::Models::PhInt::* subclass.
|
|
8
|
+
#
|
|
9
|
+
# Ph.Int. is organized by section number:
|
|
10
|
+
# 1 preface
|
|
11
|
+
# 4 general notices
|
|
12
|
+
# 5 abbreviations
|
|
13
|
+
# 6.1 pharmaceutical substances (chemical)
|
|
14
|
+
# 6.2 dosage forms
|
|
15
|
+
# 6.3 radiopharmaceuticals (specific)
|
|
16
|
+
# 7 methods
|
|
17
|
+
# 8 radiopharmaceuticals (general)
|
|
18
|
+
# 9 reagents / reference substances
|
|
19
|
+
# 10 supplementary
|
|
20
|
+
#
|
|
21
|
+
class Classifier
|
|
22
|
+
SECTION_PATTERNS = [
|
|
23
|
+
{ regex: %r{\A6\.1\.}, klass: 'DosageFormMonograph' }, # default for 6.1 — overridden below
|
|
24
|
+
{ regex: %r{\A6\.2\.1\.}, klass: 'DosageFormMonograph' },
|
|
25
|
+
{ regex: %r{\A6\.2\.2\.}, klass: 'DosageFormMonograph' },
|
|
26
|
+
{ regex: %r{\A6\.3\.}, klass: 'RadiopharmaceuticalMonograph' },
|
|
27
|
+
{ regex: %r{\A7\.}, klass: 'TestMethod' },
|
|
28
|
+
{ regex: %r{\A8\.}, klass: 'RadiopharmaceuticalMonograph' },
|
|
29
|
+
{ regex: %r{\A9\.}, klass: 'Reagent' },
|
|
30
|
+
].freeze
|
|
31
|
+
|
|
32
|
+
SECTION_DEFAULTS = {
|
|
33
|
+
'6.1' => 'DosageFormMonograph', # Ph.Int. substances are typically 6.1.x
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
36
|
+
FINAL_FALLBACK = 'Monograph'.freeze
|
|
37
|
+
|
|
38
|
+
class << self
|
|
39
|
+
# @param section_id [String, nil] e.g., "6.1.1", "7.1", "9.1"
|
|
40
|
+
# @param entity_type [String, nil] Optional explicit type hint
|
|
41
|
+
# @return [Class] a subclass of Openphar::Models::PhInt's namespaces
|
|
42
|
+
def classify(section_id:, entity_type: nil)
|
|
43
|
+
return Openphar::Models::Monograph if section_id.nil? || section_id.empty?
|
|
44
|
+
|
|
45
|
+
klass_name = resolve(section_id)
|
|
46
|
+
# Ph.Int. classes live under Openphar::Models::PhInt::*
|
|
47
|
+
return Openphar::Models::PhInt.const_get(klass_name) if Openphar::Models::PhInt.const_defined?(klass_name)
|
|
48
|
+
|
|
49
|
+
Openphar::Models::Monograph
|
|
50
|
+
rescue NameError
|
|
51
|
+
Openphar::Models::Monograph
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def all_types
|
|
55
|
+
%i[RadiopharmaceuticalMonograph DosageFormMonograph
|
|
56
|
+
TestMethod Reagent TestSolution VolumetricSolution
|
|
57
|
+
BufferSolution ReferenceSubstance].map do |k|
|
|
58
|
+
Openphar::Models::PhInt.const_get(k)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def resolve(section_id)
|
|
65
|
+
SECTION_PATTERNS.each do |rule|
|
|
66
|
+
return rule[:klass] if section_id.match?(rule[:regex])
|
|
67
|
+
end
|
|
68
|
+
FINAL_FALLBACK
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/openphar/migrators.rb
CHANGED
|
@@ -11,5 +11,7 @@ module Openphar
|
|
|
11
11
|
autoload :PhIntMigrator, 'openphar/migrators/phint_migrator'
|
|
12
12
|
autoload :Chp, 'openphar/migrators/chp'
|
|
13
13
|
autoload :ChpMigrator, 'openphar/migrators/chp_migrator'
|
|
14
|
+
autoload :JP, 'openphar/migrators/jp'
|
|
15
|
+
autoload :PhInt, 'openphar/migrators/ph_int'
|
|
14
16
|
end
|
|
15
17
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module AHP
|
|
6
|
+
# AHP finished-product formulation monograph.
|
|
7
|
+
#
|
|
8
|
+
class Formulation < Monograph
|
|
9
|
+
attribute :ingredients, :hash, collection: true, default: []
|
|
10
|
+
attribute :dosage_form, :string
|
|
11
|
+
attribute :adult_dose, :string
|
|
12
|
+
attribute :indications, :string, collection: true, default: []
|
|
13
|
+
|
|
14
|
+
json do
|
|
15
|
+
map 'ingredients', to: :ingredients
|
|
16
|
+
map 'dosageForm', to: :dosage_form
|
|
17
|
+
map 'adultDose', to: :adult_dose
|
|
18
|
+
map 'indications', to: :indications
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
def wire_key = 'formulation'
|
|
23
|
+
def harmonized_type = 'Formulation'
|
|
24
|
+
def jsonld_type = 'AhpFormulation'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module AHP
|
|
6
|
+
# AHP crude drug (herbal substance) monograph.
|
|
7
|
+
#
|
|
8
|
+
class HerbalMonograph < Monograph
|
|
9
|
+
attribute :parts_used, :string, collection: true, default: []
|
|
10
|
+
attribute :botanical_description, :hash, default: {}
|
|
11
|
+
attribute :constituents, :hash, default: {}
|
|
12
|
+
attribute :therapeutic_actions, :string, collection: true, default: []
|
|
13
|
+
attribute :clinical_evidence, :hash, default: {}
|
|
14
|
+
attribute :safety_rating, :string
|
|
15
|
+
attribute :contraindications, :string, collection: true, default: []
|
|
16
|
+
attribute :drug_interactions, :string, collection: true, default: []
|
|
17
|
+
attribute :side_effects, :string, collection: true, default: []
|
|
18
|
+
attribute :dosage_forms, :string, collection: true, default: []
|
|
19
|
+
attribute :adult_dose, :string
|
|
20
|
+
|
|
21
|
+
json do
|
|
22
|
+
map 'partsUsed', to: :parts_used
|
|
23
|
+
map 'botanicalDescription', to: :botanical_description
|
|
24
|
+
map 'constituents', to: :constituents
|
|
25
|
+
map 'therapeuticActions', to: :therapeutic_actions
|
|
26
|
+
map 'clinicalEvidence', to: :clinical_evidence
|
|
27
|
+
map 'safetyRating', to: :safety_rating
|
|
28
|
+
map 'contraindications', to: :contraindications
|
|
29
|
+
map 'drugInteractions', to: :drug_interactions
|
|
30
|
+
map 'sideEffects', to: :side_effects
|
|
31
|
+
map 'dosageForms', to: :dosage_forms
|
|
32
|
+
map 'adultDose', to: :adult_dose
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class << self
|
|
36
|
+
def wire_key = 'herbal_monograph'
|
|
37
|
+
def harmonized_type = 'CrudeDrug'
|
|
38
|
+
def jsonld_type = 'AhpHerbalMonograph'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module AHP
|
|
6
|
+
# Base class for American Herbal Pharmacopoeia monographs.
|
|
7
|
+
#
|
|
8
|
+
# AHP monographs carry the most extensive botanical and clinical
|
|
9
|
+
# evidence of any pharmacopoeia, including safety ratings and
|
|
10
|
+
# contraindications.
|
|
11
|
+
#
|
|
12
|
+
class Monograph < Openphar::Models::Monograph
|
|
13
|
+
attribute :common_name, :string
|
|
14
|
+
attribute :latin_name, :string
|
|
15
|
+
attribute :family, :string
|
|
16
|
+
|
|
17
|
+
json do
|
|
18
|
+
map 'commonName', to: :common_name
|
|
19
|
+
map 'latinName', to: :latin_name
|
|
20
|
+
map 'family', to: :family
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
def wire_key = 'monograph'
|
|
25
|
+
def harmonized_type = nil
|
|
26
|
+
def jsonld_type = 'AhpMonograph'
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/openphar/models/ahp.rb
CHANGED
|
@@ -3,23 +3,10 @@
|
|
|
3
3
|
module Openphar
|
|
4
4
|
module Models
|
|
5
5
|
# American Herbal Pharmacopoeia (AHP) specific models.
|
|
6
|
-
#
|
|
7
|
-
# Contains models unique to the American Herbal Pharmacopoeia:
|
|
8
|
-
# - Western herbal monographs with comprehensive therapeutic information
|
|
9
|
-
# - Safety and efficacy profiles
|
|
10
|
-
# - Detailed analytical methods for botanicals
|
|
11
|
-
#
|
|
12
|
-
# @example
|
|
13
|
-
# # Access AHP models
|
|
14
|
-
# Openphar::Models::AHP::HerbalMonograph
|
|
15
|
-
#
|
|
16
|
-
# @see https://www.herbal-ahp.org/
|
|
17
6
|
module AHP
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# - TherapeuticProfile
|
|
22
|
-
# - SafetyProfile
|
|
7
|
+
autoload :Monograph, "openphar/models/ahp/monograph"
|
|
8
|
+
autoload :HerbalMonograph, "openphar/models/ahp/herbal_monograph"
|
|
9
|
+
autoload :Formulation, "openphar/models/ahp/formulation"
|
|
23
10
|
end
|
|
24
11
|
end
|
|
25
12
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module API
|
|
6
|
+
# Bhasma — Ayurvedic processed-mineral / metal preparation.
|
|
7
|
+
#
|
|
8
|
+
# Bhasmas are unique to Ayurvedic medicine: a mineral or metal is
|
|
9
|
+
# repeatedly calcined with herbal juices to produce an ash with
|
|
10
|
+
# therapeutic properties. Carries Rasa/Guna/Virya/Vipaka/Karma like
|
|
11
|
+
# a Dravya but with mineral-specific source + preparation method.
|
|
12
|
+
#
|
|
13
|
+
class Bhasma < Monograph
|
|
14
|
+
attribute :source_mineral, :string
|
|
15
|
+
attribute :purification_method, :string
|
|
16
|
+
attribute :preparation_method, :string
|
|
17
|
+
attribute :rasa, :string, collection: true, default: []
|
|
18
|
+
attribute :guna, :string, collection: true, default: []
|
|
19
|
+
attribute :virya, :string
|
|
20
|
+
attribute :vipaka, :string
|
|
21
|
+
attribute :karma, :string, collection: true, default: []
|
|
22
|
+
attribute :dose, :string
|
|
23
|
+
|
|
24
|
+
json do
|
|
25
|
+
map 'sourceMineral', to: :source_mineral
|
|
26
|
+
map 'purificationMethod', to: :purification_method
|
|
27
|
+
map 'preparationMethod', to: :preparation_method
|
|
28
|
+
map 'rasa', to: :rasa
|
|
29
|
+
map 'guna', to: :guna
|
|
30
|
+
map 'virya', to: :virya
|
|
31
|
+
map 'vipaka', to: :vipaka
|
|
32
|
+
map 'karma', to: :karma
|
|
33
|
+
map 'dose', to: :dose
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class << self
|
|
37
|
+
def wire_key = 'bhasma'
|
|
38
|
+
def harmonized_type = 'MineralSubstance'
|
|
39
|
+
def jsonld_type = 'ApiBhasma'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module API
|
|
6
|
+
# Ayurvedic plant-substance monograph (Dravya).
|
|
7
|
+
#
|
|
8
|
+
# Dravya = "substance" in Ayurveda. Carries the full Ayurvedic
|
|
9
|
+
# pharmacognostic profile: Panchakarma properties (Rasa/Guna/Virya/
|
|
10
|
+
# Vipaka/Karma), purity limits, constituents, dose.
|
|
11
|
+
#
|
|
12
|
+
# Mirrors the structure of `data-india-ayurvedic-pharmacopoeia/
|
|
13
|
+
# sample-monograph.md`.
|
|
14
|
+
#
|
|
15
|
+
class Dravya < Monograph
|
|
16
|
+
attribute :plant_part, :string
|
|
17
|
+
attribute :macroscopic_description, :hash, default: {}
|
|
18
|
+
attribute :microscopic_description, :hash, default: {}
|
|
19
|
+
attribute :foreign_matter_limit, :string
|
|
20
|
+
attribute :total_ash_limit, :string
|
|
21
|
+
attribute :acid_insoluble_ash_limit, :string
|
|
22
|
+
attribute :alcohol_soluble_extractive, :string
|
|
23
|
+
attribute :water_soluble_extractive, :string
|
|
24
|
+
attribute :constituents, :string, collection: true, default: []
|
|
25
|
+
attribute :rasa, :string, collection: true, default: []
|
|
26
|
+
attribute :guna, :string, collection: true, default: []
|
|
27
|
+
attribute :virya, :string
|
|
28
|
+
attribute :vipaka, :string
|
|
29
|
+
attribute :karma, :string, collection: true, default: []
|
|
30
|
+
attribute :important_formulations, :string, collection: true, default: []
|
|
31
|
+
attribute :therapeutic_uses, :string, collection: true, default: []
|
|
32
|
+
attribute :dose, :string
|
|
33
|
+
|
|
34
|
+
json do
|
|
35
|
+
map 'plantPart', to: :plant_part
|
|
36
|
+
map 'macroscopicDescription', to: :macroscopic_description
|
|
37
|
+
map 'microscopicDescription', to: :microscopic_description
|
|
38
|
+
map 'foreignMatterLimit', to: :foreign_matter_limit
|
|
39
|
+
map 'totalAshLimit', to: :total_ash_limit
|
|
40
|
+
map 'acidInsolubleAshLimit', to: :acid_insoluble_ash_limit
|
|
41
|
+
map 'alcoholSolubleExtractive', to: :alcohol_soluble_extractive
|
|
42
|
+
map 'waterSolubleExtractive', to: :water_soluble_extractive
|
|
43
|
+
map 'constituents', to: :constituents
|
|
44
|
+
map 'rasa', to: :rasa
|
|
45
|
+
map 'guna', to: :guna
|
|
46
|
+
map 'virya', to: :virya
|
|
47
|
+
map 'vipaka', to: :vipaka
|
|
48
|
+
map 'karma', to: :karma
|
|
49
|
+
map 'importantFormulations', to: :important_formulations
|
|
50
|
+
map 'therapeuticUses', to: :therapeutic_uses
|
|
51
|
+
map 'dose', to: :dose
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class << self
|
|
55
|
+
def wire_key = 'dravya'
|
|
56
|
+
def harmonized_type = 'CrudeDrug'
|
|
57
|
+
def jsonld_type = 'ApiDravya'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module API
|
|
6
|
+
# Classical Ayurvedic formulation (Asava, Arishta, Bhasma, Churna, etc.)
|
|
7
|
+
#
|
|
8
|
+
class Formulation < Monograph
|
|
9
|
+
attribute :ingredients, :hash, collection: true, default: []
|
|
10
|
+
attribute :method_of_preparation, :string
|
|
11
|
+
attribute :anupana, :string
|
|
12
|
+
attribute :dose, :string
|
|
13
|
+
attribute :indications, :string, collection: true, default: []
|
|
14
|
+
|
|
15
|
+
json do
|
|
16
|
+
map 'ingredients', to: :ingredients
|
|
17
|
+
map 'methodOfPreparation', to: :method_of_preparation
|
|
18
|
+
map 'anupana', to: :anupana
|
|
19
|
+
map 'dose', to: :dose
|
|
20
|
+
map 'indications', to: :indications
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
def wire_key = 'formulation'
|
|
25
|
+
def harmonized_type = 'Formulation'
|
|
26
|
+
def jsonld_type = 'ApiFormulation'
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module API
|
|
6
|
+
# Base class for Ayurvedic Pharmacopoeia of India monographs.
|
|
7
|
+
#
|
|
8
|
+
# Carries multi-language identity (Sanskrit, English, Latin, plus
|
|
9
|
+
# regional Indian-language synonyms — API monographs typically list
|
|
10
|
+
# 13+ language variants per plant).
|
|
11
|
+
#
|
|
12
|
+
class Monograph < Openphar::Models::Monograph
|
|
13
|
+
attribute :sanskrit_name, :string
|
|
14
|
+
attribute :english_name, :string
|
|
15
|
+
attribute :latin_name, :string
|
|
16
|
+
attribute :family, :string
|
|
17
|
+
attribute :synonyms, :hash, default: {}
|
|
18
|
+
|
|
19
|
+
json do
|
|
20
|
+
map 'sanskritName', to: :sanskrit_name
|
|
21
|
+
map 'englishName', to: :english_name
|
|
22
|
+
map 'latinName', to: :latin_name
|
|
23
|
+
map 'family', to: :family
|
|
24
|
+
map 'synonyms', to: :synonyms
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class << self
|
|
28
|
+
def wire_key = 'monograph'
|
|
29
|
+
def harmonized_type = nil
|
|
30
|
+
def jsonld_type = 'ApiMonograph'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/openphar/models/api.rb
CHANGED
|
@@ -3,27 +3,11 @@
|
|
|
3
3
|
module Openphar
|
|
4
4
|
module Models
|
|
5
5
|
# Ayurvedic Pharmacopoeia of India (API) specific models.
|
|
6
|
-
#
|
|
7
|
-
# Contains models unique to the Ayurvedic Pharmacopoeia of India:
|
|
8
|
-
# - Dravya (Ayurvedic substances) with Rasa/Guna/Virya/Vipaka/Karma properties
|
|
9
|
-
# - Traditional Ayurvedic formulations (Asava, Arishta, Bhasma, etc.)
|
|
10
|
-
# - Classical preparation methods
|
|
11
|
-
#
|
|
12
|
-
# @example
|
|
13
|
-
# # Access API models
|
|
14
|
-
# Openphar::Models::API::DravyaMonograph
|
|
15
|
-
# Openphar::Models::API::AyurvedicFormula
|
|
16
|
-
#
|
|
17
|
-
# @see https://main.ayush.gov.in/
|
|
18
6
|
module API
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# - Rasa (taste properties)
|
|
24
|
-
# - Guna (quality properties)
|
|
25
|
-
# - Virya (potency)
|
|
26
|
-
# - Vipaka (post-digestive effect)
|
|
7
|
+
autoload :Monograph, "openphar/models/api/monograph"
|
|
8
|
+
autoload :Dravya, "openphar/models/api/dravya"
|
|
9
|
+
autoload :Formulation, "openphar/models/api/formulation"
|
|
10
|
+
autoload :Bhasma, "openphar/models/api/bhasma"
|
|
27
11
|
end
|
|
28
12
|
end
|
|
29
13
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module HKCMMS
|
|
6
|
+
# Hong Kong Chinese Materia Medica Standards monograph (base + stub).
|
|
7
|
+
#
|
|
8
|
+
# TCM-specific properties (nature, flavor, meridian) are deferred;
|
|
9
|
+
# this class exists so HKCMMS records classify and serialize today.
|
|
10
|
+
#
|
|
11
|
+
class Monograph < Openphar::Models::Monograph
|
|
12
|
+
attribute :chinese_name, :string
|
|
13
|
+
attribute :english_name, :string
|
|
14
|
+
|
|
15
|
+
json do
|
|
16
|
+
map 'chineseName', to: :chinese_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 = 'HkcmmsMonograph'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module HKCMMS
|
|
6
|
+
# HKCMMS TCM crude drug monograph.
|
|
7
|
+
#
|
|
8
|
+
# Carries the four classical TCM pharmacological properties:
|
|
9
|
+
# nature (四气), flavor (五味), meridian tropism (归经), plus
|
|
10
|
+
# TCM functions (功效) and indications (主治).
|
|
11
|
+
#
|
|
12
|
+
class TcmCrudeDrug < Monograph
|
|
13
|
+
attribute :nature, :string, collection: true, default: [] # 四气: cold/cool/neutral/warm/hot
|
|
14
|
+
attribute :flavor, :string, collection: true, default: [] # 五味: sweet/sour/bitter/pungent/salty
|
|
15
|
+
attribute :meridian_tropism, :string, collection: true, default: [] # 归经
|
|
16
|
+
attribute :functions, :string, collection: true, default: [] # 功效
|
|
17
|
+
attribute :indications, :string, collection: true, default: [] # 主治
|
|
18
|
+
attribute :botanical_source, :hash, default: {}
|
|
19
|
+
attribute :parts_used, :string, collection: true, default: []
|
|
20
|
+
attribute :constituents, :hash, default: {}
|
|
21
|
+
attribute :dosage, :string
|
|
22
|
+
|
|
23
|
+
json do
|
|
24
|
+
map 'nature', to: :nature
|
|
25
|
+
map 'flavor', to: :flavor
|
|
26
|
+
map 'meridianTropism', to: :meridian_tropism
|
|
27
|
+
map 'functions', to: :functions
|
|
28
|
+
map 'indications', to: :indications
|
|
29
|
+
map 'botanicalSource', to: :botanical_source
|
|
30
|
+
map 'partsUsed', to: :parts_used
|
|
31
|
+
map 'constituents', to: :constituents
|
|
32
|
+
map 'dosage', to: :dosage
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class << self
|
|
36
|
+
def wire_key = 'tcm_crude_drug'
|
|
37
|
+
def harmonized_type = 'CrudeDrug'
|
|
38
|
+
def jsonld_type = 'HkcmmsTcmCrudeDrug'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Openphar
|
|
4
|
+
module Models
|
|
5
|
+
module HKCMMS
|
|
6
|
+
# HKCMMS classical TCM formulation (方剂).
|
|
7
|
+
#
|
|
8
|
+
class TcmFormulation < Monograph
|
|
9
|
+
attribute :ingredients, :hash, collection: true, default: []
|
|
10
|
+
attribute :method_of_preparation, :string
|
|
11
|
+
attribute :dosage, :string
|
|
12
|
+
attribute :indications, :string, collection: true, default: []
|
|
13
|
+
attribute :contraindications, :string, collection: true, default: []
|
|
14
|
+
|
|
15
|
+
json do
|
|
16
|
+
map 'ingredients', to: :ingredients
|
|
17
|
+
map 'methodOfPreparation', to: :method_of_preparation
|
|
18
|
+
map 'dosage', to: :dosage
|
|
19
|
+
map 'indications', to: :indications
|
|
20
|
+
map 'contraindications', to: :contraindications
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
def wire_key = 'tcm_formulation'
|
|
25
|
+
def harmonized_type = 'Formulation'
|
|
26
|
+
def jsonld_type = 'HkcmmsTcmFormulation'
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|