0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
It takes a CBHPM Excel spreadsheet file and give convenience methods to deal with it.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

 Project Readme

Gem Version Build Status Code Climate Test Coverage

CBHPMTable

A simple gem to wrap the CBHPM excel files from Associação Brasileira de Medicina.

CBHPM:

  • Classificação Brasileira Hierarquizada de Procedimentos Médicos (pt)
  • Brazilian Hierarchical Classification of Medical Procedures (en)

Installation

Add this line to your application's Gemfile:

gem 'cbhpm_table'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cbhpm_table

Usage

cbhpm_table = CBHPMTable.new "CBHPM 2012.xlsx"

cbhpm_table.headers
  #=> { "code"=>"ID do Procedimento", "name"=>"Descrição do Procedimento", "cir_size"=>nil, "uco"=>"Custo Operac.", "aux_qty"=>"Nº de Aux.", "an_size"=>"Porte Anestés."}

cbhpm_table.row(2)
  #=> {"code"=>"10101012", "name"=>"Em consultório (no horário normal ou preestabelecido)", "cir_size"=>"2B", "uco"=>nil, "aux_qty"=>nil, "an_size"=>nil})}

cbhpm_table.rows
  #=> # Returns an Array of Rows (as individual Hashes)

cbhpm_table.each_row do |row|
  # do whatever with the row
end

Supported editions: 3a, 4a, 5a, 2010, 2012, 2014, 2016, 2018, 2020, 2022 and 2026 (.xls, .xlsx and .xlsm). The edition is detected by the file basename.

Row values are normalized for every edition:

  • code and name come as Strings.
  • cir_size comes upcased (the 2020+ spreadsheets have a 9c).
  • uco comes as a Float.
  • aux_qty and an_size come as Integers.
  • Blank cells come as nil.

From the 2022 edition on, an_size already takes the "Novo Porte Anest" column into account. Rows without code and rows with duplicated codes are discarded.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/cbhpm_table/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Thanks to:

  • Brandon Hilkert (@brandonhilkert) - for his "Build a Ruby Gem Email Course"