Purpose

Provides a single executable, bipm-fetch, that fetches BIPM committee outcomes (CIPM, CGPM, and the consultative committees) from the official BIPM website into a local YAML tree.

The gem also exposes a Ruby library API for programmatic use.

Command-line usage

Fetch every body, every language:

$ bipm-fetch

Fetch a single body (any of: ccauv, ccem, ccl, ccm, ccpr, ccqm, ccri, cct, cctf, ccu, cgpm, cipm, jcgm, jcrb):

$ bipm-fetch --body=cgpm

Restrict to one language (en or fr):

$ bipm-fetch --body=cgpm --language=fr

Run each body in a forked child process (parallel):

$ bipm-fetch --fork

Show help:

$ bipm-fetch --help

The default output directory is ./data. Each body writes a data/<body>/meetings-{en,fr}/meeting-<id>.yml tree.

Library usage

require "bipm/data/importer"

agent = Mechanize.new
Bipm::Data::Importer.fetch(:cgpm).call(agent:, base_dir: "data")
Bipm::Data::Importer.fetch(:cipm, languages: %w[en]).call(agent:, base_dir: "data")

# All bodies:
Bipm::Data::Importer.fetch_all.each { |f| f.call(agent:, base_dir: "data") }

To read produced outcomes back:

require "bipm/data/outcomes"

Bipm::Data::Outcomes[:cgpm][:en].meetings.first.resolutions.values.first.actions

Cassettes (test fixtures)

Network requests are replayed from cassettes/ (VCR). The CGPM scraper hits post-SPA URLs that have no cassettes and runs against the live site.

To refresh cassettes:

$ BIPM_VCR_RECORD=all bundle exec rspec
$ BIPM_VCR_RECORD=new_episodes bundle exec rspec

License

Copyright Ribose. MIT license.