openphar 0.1.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.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/README.adoc +221 -0
  3. data/lib/openphar/cli/main.rb +137 -0
  4. data/lib/openphar/cli.rb +11 -0
  5. data/lib/openphar/core/slug_generator.rb +107 -0
  6. data/lib/openphar/core.rb +11 -0
  7. data/lib/openphar/errors/configuration_error.rb +8 -0
  8. data/lib/openphar/errors/monograph_not_found_error.rb +15 -0
  9. data/lib/openphar/errors/parse_error.rb +18 -0
  10. data/lib/openphar/errors/unknown_format_error.rb +8 -0
  11. data/lib/openphar/errors/unknown_publisher_error.rb +8 -0
  12. data/lib/openphar/errors/unknown_type_error.rb +8 -0
  13. data/lib/openphar/errors/validation_error.rb +15 -0
  14. data/lib/openphar/errors.rb +17 -0
  15. data/lib/openphar/exporters/coverage_validator.rb +265 -0
  16. data/lib/openphar/exporters/neo4j/model_registry.rb +130 -0
  17. data/lib/openphar/exporters/neo4j/node_builder.rb +84 -0
  18. data/lib/openphar/exporters/neo4j/property_mapper.rb +154 -0
  19. data/lib/openphar/exporters/neo4j/relationship_builder.rb +87 -0
  20. data/lib/openphar/exporters/neo4j.rb +16 -0
  21. data/lib/openphar/exporters/neo4j_exporter.rb +199 -0
  22. data/lib/openphar/exporters.rb +15 -0
  23. data/lib/openphar/linkers/chp/cross_edition_linker.rb +101 -0
  24. data/lib/openphar/linkers/chp.rb +11 -0
  25. data/lib/openphar/linkers/cross_publisher_linker.rb +295 -0
  26. data/lib/openphar/linkers/herbapedia_linker.rb +125 -0
  27. data/lib/openphar/linkers.rb +13 -0
  28. data/lib/openphar/migrators/chp/classifier.rb +86 -0
  29. data/lib/openphar/migrators/chp.rb +15 -0
  30. data/lib/openphar/migrators/chp_migrator.rb +130 -0
  31. data/lib/openphar/migrators/jp_migrator.rb +345 -0
  32. data/lib/openphar/migrators/phint_migrator.rb +426 -0
  33. data/lib/openphar/migrators.rb +15 -0
  34. data/lib/openphar/models/ahp.rb +25 -0
  35. data/lib/openphar/models/amino_acid_monograph.rb +28 -0
  36. data/lib/openphar/models/api.rb +29 -0
  37. data/lib/openphar/models/assay_specification.rb +19 -0
  38. data/lib/openphar/models/base_entity.rb +221 -0
  39. data/lib/openphar/models/biological_substance_monograph.rb +31 -0
  40. data/lib/openphar/models/chemical_drug_monograph.rb +39 -0
  41. data/lib/openphar/models/chp/biologic.rb +28 -0
  42. data/lib/openphar/models/chp/chemical_preparation.rb +28 -0
  43. data/lib/openphar/models/chp/chemical_substance.rb +28 -0
  44. data/lib/openphar/models/chp/general_chapter.rb +30 -0
  45. data/lib/openphar/models/chp/monograph.rb +116 -0
  46. data/lib/openphar/models/chp/section.rb +37 -0
  47. data/lib/openphar/models/chp/tcm_crude_drug.rb +28 -0
  48. data/lib/openphar/models/chp/tcm_extract.rb +29 -0
  49. data/lib/openphar/models/chp/tcm_formulation.rb +28 -0
  50. data/lib/openphar/models/chp.rb +33 -0
  51. data/lib/openphar/models/crude_drug_monograph.rb +31 -0
  52. data/lib/openphar/models/edition.rb +41 -0
  53. data/lib/openphar/models/formulation_monograph.rb +31 -0
  54. data/lib/openphar/models/hkcmms.rb +26 -0
  55. data/lib/openphar/models/identification_specification.rb +19 -0
  56. data/lib/openphar/models/jp/kampo_formula.rb +94 -0
  57. data/lib/openphar/models/jp.rb +21 -0
  58. data/lib/openphar/models/limit.rb +54 -0
  59. data/lib/openphar/models/mineral_substance_monograph.rb +28 -0
  60. data/lib/openphar/models/monograph.rb +58 -0
  61. data/lib/openphar/models/ph_int/buffer_solution.rb +38 -0
  62. data/lib/openphar/models/ph_int/dosage_form_monograph.rb +43 -0
  63. data/lib/openphar/models/ph_int/radiopharmaceutical_monograph.rb +52 -0
  64. data/lib/openphar/models/ph_int/reagent.rb +50 -0
  65. data/lib/openphar/models/ph_int/reference_substance.rb +50 -0
  66. data/lib/openphar/models/ph_int/test_method.rb +50 -0
  67. data/lib/openphar/models/ph_int/test_solution.rb +39 -0
  68. data/lib/openphar/models/ph_int/volumetric_solution.rb +38 -0
  69. data/lib/openphar/models/ph_int.rb +37 -0
  70. data/lib/openphar/models/physical_specification.rb +17 -0
  71. data/lib/openphar/models/publisher.rb +98 -0
  72. data/lib/openphar/models/purity_specification.rb +16 -0
  73. data/lib/openphar/models/supplement.rb +31 -0
  74. data/lib/openphar/models/test_specification.rb +29 -0
  75. data/lib/openphar/models/thp.rb +24 -0
  76. data/lib/openphar/models/vitamin_monograph.rb +28 -0
  77. data/lib/openphar/models.rb +58 -0
  78. data/lib/openphar/monograph_merger.rb +374 -0
  79. data/lib/openphar/parsers/base_monograph_parser.rb +108 -0
  80. data/lib/openphar/parsers/jp_html_parser.rb +92 -0
  81. data/lib/openphar/parsers/jp_html_parser_base.rb +113 -0
  82. data/lib/openphar/parsers/jp_ja_html_parser.rb +220 -0
  83. data/lib/openphar/parsers/phint_json_parser.rb +332 -0
  84. data/lib/openphar/parsers.rb +21 -0
  85. data/lib/openphar/registry/publisher_registry.rb +46 -0
  86. data/lib/openphar/registry/type_registry.rb +147 -0
  87. data/lib/openphar/registry.rb +24 -0
  88. data/lib/openphar/repositories/monograph_repository.rb +350 -0
  89. data/lib/openphar/repositories.rb +11 -0
  90. data/lib/openphar/transformers/jsonld_transformer.rb +106 -0
  91. data/lib/openphar/transformers.rb +11 -0
  92. data/lib/openphar/version.rb +5 -0
  93. data/lib/openphar.rb +119 -0
  94. data/ontology/bibliographic/edition.ttl +267 -0
  95. data/ontology/context/chp.jsonld +69 -0
  96. data/ontology/context/crude-drugs.jsonld +56 -0
  97. data/ontology/context/pharmacopoeia.jsonld +631 -0
  98. data/ontology/core/identification.ttl +456 -0
  99. data/ontology/core/pharmacopoeia.ttl +3427 -0
  100. data/ontology/core/substance-form.ttl +302 -0
  101. data/ontology/core/unit.ttl +493 -0
  102. data/ontology/publisher/chp/extensions.ttl +186 -0
  103. data/ontology/publisher/phint/extensions.ttl +327 -0
  104. data/ontology/quality/test-method.ttl +610 -0
  105. data/shapes/chp/monograph.ttl +153 -0
  106. data/shapes/edition-shapes.ttl +230 -0
  107. data/shapes/monograph-shapes.ttl +1324 -0
  108. metadata +319 -0
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents a crude drug monograph (herbal medicine)
6
+ #
7
+ # Crude drugs are raw plant or animal materials used in medicine.
8
+ # They have botanical sources and morphological descriptions.
9
+ class CrudeDrugMonograph < Monograph
10
+ attribute :botanical_source, :hash, default: {}
11
+ attribute :macroscopic_description, :hash, default: {}
12
+ attribute :microscopic_description, :hash, default: {}
13
+
14
+ json do
15
+ map 'botanicalSource', to: :botanical_source
16
+ map 'macroscopicDescription', to: :macroscopic_description
17
+ map 'microscopicDescription', to: :microscopic_description
18
+ end
19
+
20
+ class << self
21
+ def neo4j_labels
22
+ %w[Monograph CrudeDrug]
23
+ end
24
+
25
+ def jsonld_type
26
+ 'CrudeDrugMonograph'
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents a pharmacopoeia edition (e.g., JP18, Ph.Int.13)
6
+ #
7
+ # An edition is a specific version of a pharmacopoeia publication
8
+ # with an official publication and effective date.
9
+ class Edition < Lutaml::Model::Serializable
10
+ attribute :id, :string
11
+ attribute :edition_number, :string
12
+ attribute :pref_label, :hash, default: {}
13
+ attribute :publication_date, :date
14
+ attribute :effective_date, :date
15
+ attribute :monograph_count, :integer
16
+ attribute :edition_url, :string
17
+ attribute :official_languages, :string, collection: true, default: []
18
+ attribute :supplements, :hash, collection: true, default: []
19
+
20
+ json do
21
+ map 'id', to: :id
22
+ map 'editionNumber', to: :edition_number
23
+ map 'prefLabel', to: :pref_label
24
+ map 'publicationDate', to: :publication_date
25
+ map 'effectiveDate', to: :effective_date
26
+ map 'monographCount', to: :monograph_count
27
+ map 'editionUrl', to: :edition_url
28
+ map 'officialLanguage', to: :official_languages
29
+ map 'hasSupplement', to: :supplements
30
+ end
31
+
32
+ def iri
33
+ "#{Openphar.base_iri}/data/edition/#{id}"
34
+ end
35
+
36
+ def label(lang = 'en')
37
+ pref_label[lang] || pref_label.values.first
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents a formulation monograph
6
+ #
7
+ # Formulations are finished pharmaceutical products containing
8
+ # one or more active ingredients.
9
+ class FormulationMonograph < Monograph
10
+ attribute :dosage_form, :string
11
+ attribute :strength, :string
12
+ attribute :active_ingredients, :hash, collection: true, default: []
13
+
14
+ json do
15
+ map 'dosageForm', to: :dosage_form
16
+ map 'strength', to: :strength
17
+ map 'activeIngredient', to: :active_ingredients
18
+ end
19
+
20
+ class << self
21
+ def neo4j_labels
22
+ %w[Monograph Formulation]
23
+ end
24
+
25
+ def jsonld_type
26
+ 'FormulationMonograph'
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Hong Kong Chinese Medicine (HKCMMS) specific models.
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/
17
+ module HKCMMS
18
+ # Placeholder for HKCMMS-specific models
19
+ # Will include:
20
+ # - TcmMonograph (Traditional Chinese Medicine)
21
+ # - TcmNature (thermal nature: hot/warm/neutral/cool/cold)
22
+ # - TcmFlavor (five flavors)
23
+ # - TcmMeridian (meridian tropism)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents an identification specification
6
+ #
7
+ # Used for identity tests (TLC, spectroscopy, chemical reactions)
8
+ # to confirm the identity of a substance.
9
+ class IdentificationSpecification < TestSpecification
10
+ attribute :test_method, :string
11
+ attribute :reference_standard, :string
12
+
13
+ json do
14
+ map 'testMethod', to: :test_method
15
+ map 'referenceStandard', to: :reference_standard
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ module JP
6
+ # Represents a Kampo formula monograph from the Japan Pharmacopoeia.
7
+ #
8
+ # Kampo is the Japanese study and adaptation of traditional Chinese medicine.
9
+ # Kampo formulas are standardized herbal preparations with specific
10
+ # ingredient ratios and preparation methods defined in the JP.
11
+ #
12
+ # @example
13
+ # formula = JP::KampoFormula.new(
14
+ # id: "https://www.openphar.org/data/jp/kampo/sho-saiko-to",
15
+ # pref_label: { "en" => "Sho-Saiko-To", "ja" => "小柴胡湯" },
16
+ # formula_code: "K001",
17
+ # crude_drug_ingredients: [...]
18
+ # )
19
+ #
20
+ # @see https://www.mhlw.go.jp/topics/bukyoku/iyaku/yakkyoku/
21
+ class KampoFormula < FormulationMonograph
22
+ # JP-specific formula code (e.g., "K001")
23
+ attribute :formula_code, :string
24
+
25
+ # Japanese name in kanji
26
+ attribute :japanese_name, :string
27
+
28
+ # Crude drug ingredients with their ratios
29
+ # Each entry contains:
30
+ # - crude_drug_id: IRI reference to CrudeDrugMonograph
31
+ # - ratio: decimal ratio (e.g., 3.0 for 3 parts)
32
+ # - unit: typically "g" or "parts"
33
+ attribute :crude_drug_ingredients, :hash, collection: true, default: []
34
+
35
+ # Preparation method instructions
36
+ attribute :preparation_method, :hash, default: {}
37
+
38
+ # Daily dosage range
39
+ attribute :daily_dosage, :hash, default: {}
40
+
41
+ # Indications in Japanese traditional medicine terms
42
+ # References TCM patterns (sho)
43
+ attribute :indications, :hash, default: {}
44
+
45
+ # Contraindications and warnings
46
+ attribute :contraindications, :hash, default: {}
47
+
48
+ # Reference to TCM formula origin (if applicable)
49
+ attribute :tcm_formula_origin, :string
50
+
51
+ json do
52
+ map 'formulaCode', to: :formula_code
53
+ map 'japaneseName', to: :japanese_name
54
+ map 'crudeDrugIngredient', to: :crude_drug_ingredients
55
+ map 'preparationMethod', to: :preparation_method
56
+ map 'dailyDosage', to: :daily_dosage
57
+ map 'indication', to: :indications
58
+ map 'contraindication', to: :contraindications
59
+ map 'tcmFormulaOrigin', to: :tcm_formula_origin
60
+ end
61
+
62
+ class << self
63
+ # Neo4j node labels for graph database export
64
+ #
65
+ # @return [Array<String>]
66
+ def neo4j_labels
67
+ %w[Monograph Formulation KampoFormula]
68
+ end
69
+
70
+ # JSON-LD @type value
71
+ #
72
+ # @return [String]
73
+ def jsonld_type
74
+ 'KampoFormula'
75
+ end
76
+ end
77
+
78
+ # Returns the total number of crude drug ingredients
79
+ #
80
+ # @return [Integer]
81
+ def ingredient_count
82
+ crude_drug_ingredients.size
83
+ end
84
+
85
+ # Returns the total ratio sum (total parts)
86
+ #
87
+ # @return [Float]
88
+ def total_parts
89
+ crude_drug_ingredients.sum { |i| i[:ratio].to_f }
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
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
+ module JP
17
+ # Kampo formulas (Japanese traditional medicine)
18
+ autoload :KampoFormula, 'openphar/models/jp/kampo_formula'
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents a quantitative limit for a test specification
6
+ class Limit < Lutaml::Model::Serializable
7
+ attribute :id, :string
8
+ attribute :limit_type, :string
9
+ attribute :limit_value, :decimal
10
+ attribute :lower_limit, :decimal
11
+ attribute :upper_limit, :decimal
12
+ attribute :limit_unit, :string
13
+
14
+ json do
15
+ map '@id', to: :id
16
+ map 'limitType', to: :limit_type
17
+ map 'limitValue', to: :limit_value
18
+ map 'lowerLimit', to: :lower_limit
19
+ map 'upperLimit', to: :upper_limit
20
+ map 'limitUnit', to: :limit_unit
21
+ end
22
+
23
+ # Returns true if this is a range limit
24
+ def range?
25
+ !lower_limit.nil? && !upper_limit.nil?
26
+ end
27
+
28
+ # Returns true if this is a minimum limit
29
+ def minimum?
30
+ limit_type == 'LimitType-Minimum' ||
31
+ limit_type == 'LimitType-NotLessThan'
32
+ end
33
+
34
+ # Returns true if this is a maximum limit
35
+ def maximum?
36
+ limit_type == 'LimitType-Maximum' ||
37
+ limit_type == 'LimitType-NotMoreThan'
38
+ end
39
+
40
+ # Returns a human-readable representation
41
+ def to_s
42
+ if range?
43
+ "#{lower_limit} - #{upper_limit} #{limit_unit}"
44
+ elsif minimum?
45
+ "Not less than #{limit_value} #{limit_unit}"
46
+ elsif maximum?
47
+ "Not more than #{limit_value} #{limit_unit}"
48
+ else
49
+ "#{limit_value} #{limit_unit}"
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents a mineral substance monograph
6
+ #
7
+ # Mineral substances are inorganic compounds used in medicine.
8
+ class MineralSubstanceMonograph < ChemicalDrugMonograph
9
+ attribute :mineral_type, :string
10
+ attribute :origin, :string
11
+
12
+ json do
13
+ map 'mineralType', to: :mineral_type
14
+ map 'origin', to: :origin
15
+ end
16
+
17
+ class << self
18
+ def neo4j_labels
19
+ %w[Monograph ChemicalDrug Mineral]
20
+ end
21
+
22
+ def jsonld_type
23
+ 'MineralSubstanceMonograph'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ # Represents a pharmacopoeia monograph
6
+ #
7
+ # This is the base class for all monograph types. Each monograph knows
8
+ # how to serialize itself to Neo4j and JSON-LD formats.
9
+ class Monograph < BaseEntity
10
+ attribute :monograph_id, :string
11
+ attribute :pref_label, :hash, default: {}
12
+ attribute :definition, :hash, default: {}
13
+ attribute :publisher, :string
14
+ attribute :status, :string
15
+ attribute :belongs_to_edition, :string
16
+ attribute :test_specifications, TestSpecification, collection: true, default: []
17
+ attribute :references_preparation, :string
18
+ attribute :references_tcm_profile, :string
19
+ attribute :references_ayurveda_profile, :string
20
+ attribute :same_substance_as, :string, collection: true, default: []
21
+ attribute :has_equivalent_in, :string, collection: true, default: []
22
+
23
+ json do
24
+ map '@id', to: :id
25
+ map 'monographId', to: :monograph_id
26
+ map 'prefLabel', to: :pref_label
27
+ map 'definition', to: :definition
28
+ map 'publisher', to: :publisher
29
+ map 'status', to: :status
30
+ map 'belongsToEdition', to: :belongs_to_edition
31
+ map 'testSpecification', to: :test_specifications
32
+ map 'referencesPreparation', to: :references_preparation
33
+ map 'referencesTCMProfile', to: :references_tcm_profile
34
+ map 'referencesAyurvedaProfile', to: :references_ayurveda_profile
35
+ map 'sameSubstanceAs', to: :same_substance_as
36
+ map 'hasEquivalentIn', to: :has_equivalent_in
37
+ end
38
+
39
+ class << self
40
+ def neo4j_labels
41
+ ['Monograph']
42
+ end
43
+
44
+ def jsonld_type
45
+ 'Monograph'
46
+ end
47
+ end
48
+
49
+ def iri
50
+ "#{Openphar.base_iri}/data/monograph/#{id}"
51
+ end
52
+
53
+ def label(lang = 'en')
54
+ pref_label[lang] || pref_label.values.first
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ module PhInt
6
+ # Buffer Solution
7
+ #
8
+ # A solution that resists changes in pH when small amounts
9
+ # of acid or base are added.
10
+ #
11
+ # @example
12
+ # buffer = PhInt::BufferSolution.new(
13
+ # id: 'phint-buffer-ph7',
14
+ # ph_range: '6.8 - 7.2',
15
+ # composition: { 'components' => ['KH2PO4', 'Na2HPO4'] }
16
+ # )
17
+ class BufferSolution < Reagent
18
+ attribute :ph_range, :string
19
+ attribute :composition, :hash, default: {}
20
+
21
+ json do
22
+ map 'phRange', to: :ph_range
23
+ map 'composition', to: :composition
24
+ end
25
+
26
+ class << self
27
+ def neo4j_labels
28
+ %w[Reagent BufferSolution]
29
+ end
30
+
31
+ def jsonld_type
32
+ 'BufferSolution'
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ module PhInt
6
+ # Dosage Form Monograph
7
+ #
8
+ # Represents dosage form monographs (capsules, tablets, injections)
9
+ # in the International Pharmacopoeia.
10
+ #
11
+ # Dosage form monographs define quality standards for specific
12
+ # pharmaceutical formulations.
13
+ #
14
+ # @example
15
+ # monograph = PhInt::DosageFormMonograph.new(
16
+ # id: 'phint-tablets',
17
+ # dosage_form_type: 'Tablet',
18
+ # dissolution_specification: { 'time' => '30 min', 'limit' => '80%' }
19
+ # )
20
+ class DosageFormMonograph < Monograph
21
+ attribute :dosage_form_type, :string
22
+ attribute :dissolution_specification, :hash, default: {}
23
+ attribute :uniformity_specification, :hash, default: {}
24
+
25
+ json do
26
+ map 'dosageFormType', to: :dosage_form_type
27
+ map 'dissolutionSpecification', to: :dissolution_specification
28
+ map 'uniformitySpecification', to: :uniformity_specification
29
+ end
30
+
31
+ class << self
32
+ def neo4j_labels
33
+ %w[Monograph DosageForm]
34
+ end
35
+
36
+ def jsonld_type
37
+ 'DosageFormMonograph'
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ module PhInt
6
+ # Radiopharmaceutical Monograph
7
+ #
8
+ # Represents radiopharmaceutical substances in the International Pharmacopoeia
9
+ # with radionuclide data (half-life, emission type, etc.)
10
+ #
11
+ # Radiopharmaceuticals are unique to Ph.Int. as they contain radioactive
12
+ # isotopes used in nuclear medicine for diagnosis and therapy.
13
+ #
14
+ # @example
15
+ # monograph = PhInt::RadiopharmaceuticalMonograph.new(
16
+ # id: 'phint-sodium-iodide-i131',
17
+ # radionuclide: 'I-131',
18
+ # half_life: '8.02 days',
19
+ # emission_type: 'beta, gamma'
20
+ # )
21
+ class RadiopharmaceuticalMonograph < ChemicalDrugMonograph
22
+ attribute :radionuclide, :string
23
+ attribute :half_life, :string
24
+ attribute :emission_type, :string
25
+ attribute :radiochemical_purity, :string
26
+ attribute :radionuclidic_purity, :string
27
+ attribute :photon_fraction, :string
28
+ attribute :precursor, :string
29
+
30
+ json do
31
+ map 'radionuclide', to: :radionuclide
32
+ map 'halfLife', to: :half_life
33
+ map 'emissionType', to: :emission_type
34
+ map 'radiochemicalPurity', to: :radiochemical_purity
35
+ map 'radionuclidicPurity', to: :radionuclidic_purity
36
+ map 'photonFraction', to: :photon_fraction
37
+ map 'precursor', to: :precursor
38
+ end
39
+
40
+ class << self
41
+ def neo4j_labels
42
+ %w[Monograph ChemicalDrug Radiopharmaceutical]
43
+ end
44
+
45
+ def jsonld_type
46
+ 'RadiopharmaceuticalMonograph'
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ module PhInt
6
+ # Reagent (Base Class)
7
+ #
8
+ # Base class for all Ph.Int. reagents including test solutions,
9
+ # volumetric solutions, and buffer solutions.
10
+ #
11
+ # Reagents are chemical solutions used in pharmacopoeial testing.
12
+ #
13
+ # @example
14
+ # reagent = PhInt::Reagent.new(
15
+ # id: 'phint-reagent-sodium-hydroxide',
16
+ # reagent_id: 'TS-123',
17
+ # reagent_type: 'TestSolution',
18
+ # preparation: { 'en' => 'Dissolve 10g in 100ml water...' }
19
+ # )
20
+ class Reagent < BaseEntity
21
+ attribute :reagent_id, :string
22
+ attribute :pref_label, :hash, default: {}
23
+ attribute :reagent_type, :string
24
+ attribute :preparation, :hash, default: {}
25
+ attribute :publisher, :string
26
+ attribute :belongs_to_edition, :string
27
+
28
+ json do
29
+ map '@id', to: :id
30
+ map 'reagentId', to: :reagent_id
31
+ map 'prefLabel', to: :pref_label
32
+ map 'reagentType', to: :reagent_type
33
+ map 'preparation', to: :preparation
34
+ map 'publisher', to: :publisher
35
+ map 'belongsToEdition', to: :belongs_to_edition
36
+ end
37
+
38
+ class << self
39
+ def neo4j_labels
40
+ ['Reagent']
41
+ end
42
+
43
+ def jsonld_type
44
+ 'Reagent'
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Openphar
4
+ module Models
5
+ module PhInt
6
+ # Reference Substance
7
+ #
8
+ # A chemical substance of known purity used as a reference
9
+ # standard in analytical testing.
10
+ #
11
+ # @example
12
+ # substance = PhInt::ReferenceSubstance.new(
13
+ # id: 'phint-rs-aspirin',
14
+ # reference_id: 'RS-123',
15
+ # cas_number: '50-78-2',
16
+ # assigned_content: '99.5%'
17
+ # )
18
+ class ReferenceSubstance < BaseEntity
19
+ attribute :reference_id, :string
20
+ attribute :pref_label, :hash, default: {}
21
+ attribute :cas_number, :string
22
+ attribute :assigned_content, :string
23
+ attribute :storage_conditions, :hash, default: {}
24
+ attribute :publisher, :string
25
+ attribute :belongs_to_edition, :string
26
+
27
+ json do
28
+ map '@id', to: :id
29
+ map 'referenceId', to: :reference_id
30
+ map 'prefLabel', to: :pref_label
31
+ map 'casNumber', to: :cas_number
32
+ map 'assignedContent', to: :assigned_content
33
+ map 'storageConditions', to: :storage_conditions
34
+ map 'publisher', to: :publisher
35
+ map 'belongsToEdition', to: :belongs_to_edition
36
+ end
37
+
38
+ class << self
39
+ def neo4j_labels
40
+ ['ReferenceSubstance']
41
+ end
42
+
43
+ def jsonld_type
44
+ 'ReferenceSubstance'
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end