{"id":19357978,"url":"https://github.com/populatetools/ruby_px","last_synced_at":"2025-04-23T11:31:00.829Z","repository":{"id":54176255,"uuid":"48270085","full_name":"PopulateTools/ruby_px","owner":"PopulateTools","description":"Deal with PC-Axis files in an easy way","archived":false,"fork":false,"pushed_at":"2023-12-18T15:49:20.000Z","size":1861,"stargazers_count":27,"open_issues_count":0,"forks_count":11,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-28T17:20:37.104Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PopulateTools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-19T05:42:46.000Z","updated_at":"2024-01-20T18:44:11.000Z","dependencies_parsed_at":"2022-08-13T08:20:52.917Z","dependency_job_id":null,"html_url":"https://github.com/PopulateTools/ruby_px","commit_stats":null,"previous_names":["populatetools/ruby-px"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PopulateTools%2Fruby_px","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PopulateTools%2Fruby_px/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PopulateTools%2Fruby_px/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PopulateTools%2Fruby_px/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PopulateTools","download_url":"https://codeload.github.com/PopulateTools/ruby_px/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223922098,"owners_count":17225636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T07:09:54.751Z","updated_at":"2024-11-10T07:09:55.525Z","avatar_url":"https://github.com/PopulateTools.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RubyPx\n\n[![Gem Version](https://badge.fury.io/rb/ruby_px.svg)](https://badge.fury.io/rb/ruby_px)\n[![Build Status](https://travis-ci.org/PopulateTools/ruby_px.svg?branch=master)](https://travis-ci.org/PopulateTools/ruby_px)\n\nWork with PC-Axis files using Ruby.\n\n## Motivation\n\nThe Spanish Statistics Institute ([INE](http://www.ine.es/welcome.shtml)) favourite format to publish\nthe data is PC-Axis, a semi-plain-text format which is kind of difficult to work with unless you\nhave a PC with Windows installed in.\n\nThere is a library in R called [pxR](https://github.com/cran/pxR) from [@gilbellosta](https://twitter.com/gilbellosta), but I don't know more alternatives in other programming languages.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ruby_px'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install ruby_px\n\n## Usage\n\n```ruby\n# Load a dataset\ndataset = RubyPx::Dataset.new 'spec/fixtures/ine-padron-2014.px'\n\n# Query some metadata\ndataset.title\n=\u003e \"Población por sexo, municipios y edad (año a año).\"\n\ndataset.units\n=\u003e \"personas\"\n\ndataset.source\n=\u003e \"Instituto Nacional de Estadística\"\n\ndataset.contact\n=\u003e \"INE E-mail:www.ine.es/infoine. Internet: www.ine.es. Tel: +34 91 583 91 00 Fax: +34 91 583 91 58\"\n\ndataset.last_updated\n=\u003e \"05/10/99\" # Really, INE?\n\ndataset.creation_date\n=\u003e \"20141201\"\n\n# Obtain the headings and the stubs\ndataset.headings\n=\u003e [\"edad (año a año)\"]\n\ndataset.stubs\n=\u003e [\"sexo\", \"municipios\"]\n\n# Obtain the dimensions of the dataset\ndataset.dimensions\n=\u003e [\"sexo\", \"edad (año a año)\", \"municipios\"]\n\n# Get the list of values of a dimension\ndataset.dimension('sexo')\n=\u003e [\"Ambos sexos\", \"Hombres\", \"Mujeres\"]\n\n# Query the data using the method #data\n# You can query the data in two ways:\n# 1 - providing all the dimensions, so you'll obtain a single value\ndataset.data('edad (año a año)' =\u003e 'Total', 'sexo' =\u003e 'Ambos sexos', 'municipios' =\u003e '28079-Madrid')\n=\u003e \"3165235\"\n\n# 2 - providing all the dimensions except one, so you'll obtain an array\ndataset.data('edad (año a año)' =\u003e 'Total', 'sexo' =\u003e 'Ambos sexos')\n=\u003e [....] # an array with the population of all places for all ages and both sexs\n\n```\n\n## TODO\n\n- Refactor\n- Test the gem with more files\n- Speed-up the parsing time\n\n\n## Development\n\nAfter checking out the repository, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/PopulateTools/ruby_px. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.\n\n## Thanks\n\nThank you [Xavier Badosa](https://twitter.com/badosa) for inspiring me with [json-stat.org](http://json-stat.org/) and the API of\nthe Javascript library [json-stat.com](http://json-stat.com/).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpopulatetools%2Fruby_px","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpopulatetools%2Fruby_px","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpopulatetools%2Fruby_px/lists"}