OWL 2 Ontology JSON-LD Format Development Status

Purpose

Open Pharmacopoeia provides a harmonized ontology for representing pharmacopoeia monographs from multiple publishers. The project enables cross-publisher comparison of quality standards by normalizing test methods and specifications.

This project integrates with https://github.com/lutaml/data-herbapedia for botanical and medicine system data, while open-pharmacopoeia focuses on quality standards and test specifications.

Architecture

Open-Pharmacopoeia Architecture Layers
data-herbapedia:  Plant → Part → Preparation → Medicine System Profiles
                                              ↓
open-pharmacopoeia:                      PharmacopoeiaMonograph
                                              ├── TestSpecification
                                              ├── Assay
                                              └── SafetyInformation

Integration with data-herbapedia

Layer Responsibility

data-herbapedia

Botanical data (PlantSpecies, PlantPart), HerbalPreparation, Medicine System Profiles (TCM, Ayurveda, Western)

open-pharmacopoeia

Quality standards (TestSpecification, Assay), Test methods (HarmonizedMethod), Publisher-specific data

The key integration point is op:referencesPreparation, which links a PharmacopoeiaMonograph to a HerbalPreparation in data-herbapedia.

Features

  • Harmonized Ontology - Common vocabulary for representing pharmacopoeia monographs from any publisher

  • Cross-Publisher Comparison - Harmonized test methods enable comparison across publishers

  • Crude Drug Support - Extended model for herbal medicines with macroscopic/microscopic descriptions

  • data-herbapedia Integration - Links to botanical and medicine system data

  • Multilingual Support - Full internationalization with language-tagged strings

  • SHACL Validation - Shapes for validating monograph data

Installation

Add this line to your application’s Gemfile:

gem 'open-pharmacopoeia', git: 'https://github.com/lutaml/open-pharmacopoeia'

And then execute:

bundle install

Usage

Loading a Monograph

require 'open_pharmacopoeia'

# Load from JSON-LD
monograph = OpenPharmacopoeia::CrudeDrugMonograph.from_json(File.read('data/jp/radix-ginseng.jsonld'))

# Access monograph properties
monograph.label("en")  #=> "Ginseng Radix"
monograph.publisher.name  #=> "Japan Pharmacopoeia"
monograph.assays.each do |assay|
  puts "#{assay.assay_target}: #{assay.limit}"
end

Creating a New Monograph

require 'open_pharmacopoeia'

monograph = OpenPharmacopoeia::CrudeDrugMonograph.new(
  monograph_id: "JP18-001",
  publisher: OpenPharmacopoeia::Publisher.find("JP"),
  pref_label: { "en" => "Ginseng Radix", "ja" => "人参" },
  references_preparation: "https://www.herbapedia.org/entity/preparation/dried-ginseng-root"
)

# Add test specification
monograph.test_specifications << OpenPharmacopoeia::PhysicalSpecification.new(
  test_name: "Total Ash",
  test_type: OpenPharmacopoeia::TestType.find("Physical"),
  harmonized_method: OpenPharmacopoeia::HarmonizedMethod.find("TotalAsh"),
  limit: OpenPharmacopoeia::Limit.new(
    limit_type: OpenPharmacopoeia::LimitType.find("NotMoreThan"),
    limit_value: 4.2,
    limit_unit: OpenPharmacopoeia::Unit.find("percent")
  )
)

Ontology Structure

Core Classes

Class Description

op:PharmacopoeiaMonograph

Central class representing a pharmacopoeia monograph

op:CrudeDrugMonograph

Extended monograph for herbal medicines

op:TestSpecification

Generic test specification (value object)

op:AssaySpecification

Quantitative analysis specification

op:PuritySpecification

Impurity limit specification

op:HarmonizedMethod

Harmonized test method for cross-publisher comparison

op:Publisher

Pharmacopoeia publisher enumeration

External References

Monographs reference external entities in data-herbapedia:

op:Ginseng-Monograph
    op:referencesPreparation <https://www.herbapedia.org/entity/preparation/dried-ginseng-root> ;
    op:referencesTCMProfile <https://www.herbapedia.org/system/tcm/profile/ren-shen> .

Test Method Harmonization

# Harmonized method with publisher equivalents
method:HPLC a op:HarmonizedMethod ;
    rdfs:label "HPLC"@en ;
    op:jpReference "as directed under Liquid Chromatography <2.01>" ;
    op:equivalentMethod api:Appendix-2.2.29 ;
    op:equivalentMethod hkcmms:Appendix-IV-B .

File Structure

open-pharmacopoeia/
├── ontology/
│   ├── core/
│   │   ├── pharmacopoeia.ttl     # Core classes and properties
│   │   └── unit.ttl              # Measurement units
│   ├── quality/
│   │   └── test-method.ttl       # Harmonized test methods
│   └── context/
│       └── pharmacopoeia.jsonld  # JSON-LD context
├── data/
│   ├── jp/                       # Japan Pharmacopoeia monographs
│   ├── hkcmms/                   # Hong Kong CMMS monographs
│   └── api/                      # Ayurvedic Pharmacopoeia of India
├── shapes/
│   └── monograph-shapes.ttl      # SHACL validation shapes
├── tools/
│   └── lib/
│       └── open_pharmacopoeia/   # Ruby models
└── reference-docs/               # Reference pharmacopoeia documents

Supported Publishers

Code Name Country

AHP

American Herbal Pharmacopoeia

US

API

Ayurvedic Pharmacopoeia of India

IN

JP

Japan Pharmacopoeia

JP

HKCMMS

Hong Kong Chinese Materia Medica Standards

HK

THP

Thai Herbal Pharmacopoeia

TH

CMHerbarium

CM Herbarium

CN

WHO

WHO Monographs on Selected Medicinal Plants

INT

UPB

Unani Pharmacopoeia of Bangladesh

BD

UPI

Unani Pharmacopoeia of India

IN

APB

Ayurvedic Pharmacopoeia of Bangladesh

BD

APS

Ayurvedic Pharmacopoeia of Sri Lanka

LK

Development

After checking out the repo, run:

bundle install
bundle exec rake spec    # Run tests
bundle exec rubocop      # Run linter

License

This project is available as open source under the terms of the MIT License.