{"id":15293320,"url":"https://github.com/topac/codice_fiscale","last_synced_at":"2025-08-19T08:41:48.184Z","repository":{"id":5773148,"uuid":"6986758","full_name":"topac/codice_fiscale","owner":"topac","description":"A Ruby gem that calculates the Italian Tax ID (Codice Fiscale)","archived":false,"fork":false,"pushed_at":"2024-03-27T11:07:46.000Z","size":312,"stargazers_count":18,"open_issues_count":0,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T04:22:52.360Z","etag":null,"topics":["calculator","codice-fiscale","codicefiscale","generator","italian","italy","ruby","rubygems","tax","taxid"],"latest_commit_sha":null,"homepage":"","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/topac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2012-12-03T17:52:03.000Z","updated_at":"2024-07-25T15:40:32.000Z","dependencies_parsed_at":"2024-03-27T12:26:57.198Z","dependency_job_id":"8bc0e776-b62e-4884-a752-1a57c43634a5","html_url":"https://github.com/topac/codice_fiscale","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":"0.038461538461538436","last_synced_commit":"24ff53057be7ad16cf585c0e93bfd5fc61f14abf"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fcodice_fiscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fcodice_fiscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fcodice_fiscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topac%2Fcodice_fiscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/topac","download_url":"https://codeload.github.com/topac/codice_fiscale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248718961,"owners_count":21150669,"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":["calculator","codice-fiscale","codicefiscale","generator","italian","italy","ruby","rubygems","tax","taxid"],"created_at":"2024-09-30T16:46:13.334Z","updated_at":"2025-04-13T13:24:39.185Z","avatar_url":"https://github.com/topac.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/codice-fiscale.svg)](https://badge.fury.io/rb/codice-fiscale)\n[![Build Status](https://travis-ci.org/topac/codice_fiscale.svg?branch=master)](https://travis-ci.org/topac/codice_fiscale)\n\n# Codice Fiscale (Italian Tax ID)\n\nA Ruby gem that calculates the *Codice Fiscale* (Italian Tax ID).\n\nThe *Codice Fiscale* is an identifier unique to each person that is used when dealing with Italian government offices or for private concerns and is formulated using a combination of the person’s name, place and date of birth.  Usually it is attributed by the Office of Income Revenue (*Agenzia delle Entrate*) through local tax offices.\n\nThe code is 16 characters long and includes both letters and numbers, for e.g: `RSSMRA90A01H501W` (taken from [this sample card](https://i.imgur.com/UVXKDX8.png)). Read more on [wikipedia](http://en.wikipedia.org/wiki/Italian_fiscal_code_card) or [here](https://itamcap.com/italian-tax-id).\n\n\n## Installation\n\n**WARNING:** The gem name on rubygems.org is \"codice-fiscale\" not \"codice_fiscale\"\n\nAdd this line to your application's Gemfile:\n```ruby\n    source 'https://rubygems.org'\n    gem 'codice-fiscale'\n```\n\nAnd then execute the `bundle install` command.\n\n## Usage\n\n```ruby\n  require 'codice_fiscale'\n\n  CodiceFiscale.calculate(\n    :name          =\u003e 'Mario',\n    :surname       =\u003e 'Rossi',\n    :gender        =\u003e :male,\n    :birthdate     =\u003e Date.new(1987, 1, 1),\n    :province_code =\u003e 'MI',\n    :city_name     =\u003e 'Milano'\n  )\n  # =\u003e RSSMRA87A01F205E\n```\n\n## City codes (Codici Catastali)\nAs explained above, one of the information required to calculate the tax ID is the birthplace.  \nIf a person was born outside Italy, only the italian name of the country is required.  \nFor example, an italian citizen born in France:\n\n```ruby\n  CodiceFiscale.calculate(\n    :name         =\u003e 'Mario', \n    :surname      =\u003e 'Rossi', \n    :gender       =\u003e :male, \n    :birthdate    =\u003e Date.new(1987, 1, 1), \n    :country_name =\u003e 'Francia'\n  )\n  # =\u003e RSSMRA87A01Z110I\n```\n\nIf a person was born in Italy you have to specify the *code* of the province and the *name* of the city. These informations are actually contained in a CSV \ndocument downloaded from [istat.it](http://www.istat.it/it/archivio/6789), converted and shipped with this gem.\n\n\n**But what if you have your own table with all those codes?**\n\nIn this case, you can add a custom block that fetches the codes from your database:\n\n\n*config/initializers/codice_fiscale_initializer.rb*:\n\n```ruby\n  CodiceFiscale.config.country_code do |country_name|\n    # Place your code here, for e.g.:\n    YourCountryActiveRecordModel.find_by_name(country_name).code\n    # So that given for e.g. country_name=\"Denmark\" the returned code must be \"Z107\"\n    # Checkout the file ./lib/codice_fiscale/codes/country_codes.csv\n  end\n\n  CodiceFiscale.config.city_code do |city_name, province_code|\n    # Place your code here, for e.g.:\n    YourCityActiveRecordModel.find_by_province_and_city(province_code, city_name).code\n    # So that given for e.g. city_name=\"Fiumicino\", province_code=\"RM\" the returned code must be \"M297\"\n    # Checkout the file ./lib/codice_fiscale/codes/city_codes.csv\n  end\n```\n\n\n## Testing\n\n    $ bundle exec rspec\n\nThis gem is tested with all ruby versions starting from 1.9.3.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopac%2Fcodice_fiscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftopac%2Fcodice_fiscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopac%2Fcodice_fiscale/lists"}