Class: Openphar::Models::JP::KampoFormula

Inherits:
FormulationMonograph show all
Defined in:
lib/openphar/models/jp/kampo_formula.rb

Overview

Represents a Kampo formula monograph from the Japan Pharmacopoeia.

Kampo is the Japanese study and adaptation of traditional Chinese medicine. Kampo formulas are standardized herbal preparations with specific ingredient ratios and preparation methods defined in the JP.

Examples:

formula = JP::KampoFormula.new(
  id: "https://www.openphar.org/data/jp/kampo/sho-saiko-to",
  pref_label: { "en" => "Sho-Saiko-To", "ja" => "小柴胡湯" },
  formula_code: "K001",
  crude_drug_ingredients: [...]
)

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Monograph

#iri, #label

Methods inherited from BaseEntity

jsonld_context, neo4j_label, neo4j_labels_string, #to_cypher, #to_cypher_match, #to_jsonld, #to_neo4j_node, #to_neo4j_properties

Class Method Details

.jsonld_typeString

JSON-LD @type value

Returns:

  • (String)


73
74
75
# File 'lib/openphar/models/jp/kampo_formula.rb', line 73

def jsonld_type
  'KampoFormula'
end

.neo4j_labelsArray<String>

Neo4j node labels for graph database export

Returns:

  • (Array<String>)


66
67
68
# File 'lib/openphar/models/jp/kampo_formula.rb', line 66

def neo4j_labels
  %w[Monograph Formulation KampoFormula]
end

Instance Method Details

#ingredient_countInteger

Returns the total number of crude drug ingredients

Returns:

  • (Integer)


81
82
83
# File 'lib/openphar/models/jp/kampo_formula.rb', line 81

def ingredient_count
  crude_drug_ingredients.size
end

#total_partsFloat

Returns the total ratio sum (total parts)

Returns:

  • (Float)


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

def total_parts
  crude_drug_ingredients.sum { |i| i[:ratio].to_f }
end