{"id":37071098,"url":"https://github.com/aiboxlab-pne/popro","last_synced_at":"2026-01-14T08:18:15.861Z","repository":{"id":57679138,"uuid":"485528612","full_name":"aiboxlab-pne/popro","owner":"aiboxlab-pne","description":"A population projection engine","archived":false,"fork":false,"pushed_at":"2022-06-03T12:08:53.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-31T09:52:09.395Z","etag":null,"topics":["population","projection"],"latest_commit_sha":null,"homepage":"","language":"Python","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/aiboxlab-pne.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-25T20:42:10.000Z","updated_at":"2022-05-17T11:44:12.000Z","dependencies_parsed_at":"2022-08-28T05:52:55.318Z","dependency_job_id":null,"html_url":"https://github.com/aiboxlab-pne/popro","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aiboxlab-pne/popro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiboxlab-pne%2Fpopro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiboxlab-pne%2Fpopro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiboxlab-pne%2Fpopro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiboxlab-pne%2Fpopro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiboxlab-pne","download_url":"https://codeload.github.com/aiboxlab-pne/popro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiboxlab-pne%2Fpopro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["population","projection"],"created_at":"2026-01-14T08:18:14.877Z","updated_at":"2026-01-14T08:18:15.851Z","avatar_url":"https://github.com/aiboxlab-pne.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=====\npopro\n=====\n\n\n.. image:: https://img.shields.io/pypi/v/popro.svg\n        :target: https://pypi.python.org/pypi/popro\n\n.. image:: https://github.com/aiboxlab-pne/popro/actions/workflows/python-app.yml/badge.svg\n        :target: https://github.com/aiboxlab-pne/popro/actions/workflows/python-app.yml\n\n.. image:: https://readthedocs.org/projects/popro/badge/?version=latest\n        :target: https://popro.readthedocs.io/en/latest/?version=latest\n        :alt: Documentation Status\n\n\n\n\nA population projection engine\n\n\n* Free software: MIT license\n* Documentation: https://popro.readthedocs.io.\n\nFeatures\n--------\n\n* Calculates population projection segmented by age over the years\n        * Methodology:\n                * Presented by the Special Activities Board of the `Court of Auditors`_ of the State of Santa Catarina (Brazil), in the technical note `Memo. DAE n° 020/2021`_.\n        * Overview:\n                * Inputs:\n                        * Specific year census dataset (place, age, population)\n                        * Dataset of people born over the years (year, place, births)\n                        * Projected population dataset not segmented by age over the years (year, place, population)\n                * Output:\n                        * Population projection segmented by age dataset (year, place, age, population)\n                        * Errors report on combination of \"place, age, year\" unable to forecast (year, place, age, error_msg)\n\n=====\nUsage\n=====\n\nFirst let's generate Input CSV files to serve as a sample.\n\n.. code-block:: python\n\n   import csv\n\n   def write_csv(file_path, list_data):\n      with open(file_path, 'w', encoding='UTF8', newline='') as f:\n         writer = csv.writer(f)\n         for line in list_data:\n               writer.writerow(line)\n\n   data_birth = [['births', 'place', 'year'],\n                 [102,'ny',2011],\n                 [116,'ny',2012],\n                 [94,'ny',2013],\n                 [123,'ny',2014],\n                 [156,'ny',2015]]\n\n   data_census = [['age', 'population', 'place', 'year'],\n                  [0, 100,  'ny', 2010],\n                  [1, 110,  'ny', 2010],\n                  [2, 105,  'ny', 2010],\n                  [3, 102,  'ny', 2010]]\n\n   data_population = [['population', 'place', 'year'],\n                      [2010, 'ny', 2010],\n                      [2100, 'ny', 2011],\n                      [2050, 'ny', 2012],\n                      [2040, 'ny', 2013],\n                      [2090, 'ny', 2014],\n                      [1950, 'ny', 2015]]\n\n   write_csv(file_path='births.csv', list_data=data_birth)\n   write_csv(file_path='census.csv', list_data=data_census)\n   write_csv(file_path='population.csv', list_data=data_population)\n\nNow let's import the lib Popro and generate our projection engine.\n\n.. code-block:: python\n\n   from popro import popro\n\n   dict_input = {'path_census': 'census.csv', 'path_births': 'births.csv', 'path_population': 'population.csv', 'year_census': 2010}\n   engine = popro.Popro(dict_input)\n\nWe are ready! Let's start by doing some punctual projections of year, age and place.\n\nFirst we will try with an age and year whose birth of the group is prior to the census.\n\n.. code-block:: python\n\n   engine.project(year=2012, place='ny', age=3, verbose=True)\n\n\n.. code-block:: text\n\n   pop_ny_2010_age_1 * (pop_ny_2012 / pop_ny_2010)\n   110 * (2050 / 2010)\n\n   112.18905472636816\n\n\nNow let's find out the projection for a group born after the census.\n\n.. code-block:: python\n\n   engine.project(year=2015, place='ny', age=4, verbose=True)\n\n\n.. code-block:: text\n\n   birth_ny_year_2011 * (pop_ny_2015 / pop_ny_2011)\n   102 * (1950 / 2100)\n\n   94.71428571428572\n\nFinally we will generate a report with all possible combinations of year, age and place.\n\n.. code-block:: python\n\n   engine.project_all()\n\n\n.. code-block:: text\n\n   [{'year': 2011, 'place': 'ny', 'age': 0, 'quantity': 102.0},\n    {'year': 2011, 'place': 'ny', 'age': 1, 'quantity': 104.4776119402985},\n    {'year': 2011, 'place': 'ny', 'age': 2, 'quantity': 114.92537313432835},\n    {'year': 2011, 'place': 'ny', 'age': 3, 'quantity': 109.70149253731343},\n    {'year': 2012, 'place': 'ny', 'age': 0, 'quantity': 116.0},\n    {'year': 2012, 'place': 'ny', 'age': 1, 'quantity': 99.57142857142857},\n    {'year': 2012, 'place': 'ny', 'age': 2, 'quantity': 101.99004975124377},\n    {'year': 2012, 'place': 'ny', 'age': 3, 'quantity': 112.18905472636816},\n    {'year': 2013, 'place': 'ny', 'age': 0, 'quantity': 94.0},\n    {'year': 2013, 'place': 'ny', 'age': 1, 'quantity': 115.43414634146342},\n    {'year': 2013, 'place': 'ny', 'age': 2, 'quantity': 99.08571428571429},\n    {'year': 2013, 'place': 'ny', 'age': 3, 'quantity': 101.49253731343283},\n    {'year': 2014, 'place': 'ny', 'age': 0, 'quantity': 123.0},\n    {'year': 2014, 'place': 'ny', 'age': 1, 'quantity': 96.30392156862744},\n    {'year': 2014, 'place': 'ny', 'age': 2, 'quantity': 118.26341463414634},\n    {'year': 2014, 'place': 'ny', 'age': 3, 'quantity': 101.51428571428572},\n    {'year': 2015, 'place': 'ny', 'age': 0, 'quantity': 156.0},\n    {'year': 2015, 'place': 'ny', 'age': 1, 'quantity': 114.76076555023923},\n    {'year': 2015, 'place': 'ny', 'age': 2, 'quantity': 89.8529411764706},\n    {'year': 2015, 'place': 'ny', 'age': 3, 'quantity': 110.34146341463415}]\n\nCool, but it would be better to export to a CSV, wouldn't it?\n\n.. code-block:: python\n\n   engine.project_all(output_report_projection_path='projection_report.csv')\n\nReport generated!\n\nCLI\n-----\n\nIt is also possible to make projections via command line. Let's repeat the same projections:\n\n.. code-block:: text\n\n    $ popro -i path_census,census.csv -i path_births,births.csv -i path_population,population.csv -i year_census,2010 --year 2012 --place ny --age 3\n\n.. code-block:: text\n\n    112.18905472636816\n\n.. code-block:: text\n\n    $ popro -i path_census,census.csv -i path_births,births.csv -i path_population,population.csv -i year_census,2010 --year 2015 --place ny --age 4\n.. code-block:: text\n\n    94.71428571428572\n\n.. code-block:: text\n\n    $ popro -i path_census,census.csv -i path_births,births.csv -i path_population,population.csv -i year_census,2010 --output projection_report.csv\n\n.. _`Court of Auditors`: https://www.tcesc.tc.br/\n.. _`Memo. DAE n° 020/2021`: https://www.tcesc.tc.br/sites/default/files/2021-06/Metodologia%20Estima%C3%A7%C3%A3o%20Populacional.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiboxlab-pne%2Fpopro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiboxlab-pne%2Fpopro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiboxlab-pne%2Fpopro/lists"}