{"id":20279223,"url":"https://github.com/peterhellberg/population","last_synced_at":"2025-11-29T19:06:19.729Z","repository":{"id":136623266,"uuid":"43637372","full_name":"peterhellberg/population","owner":"peterhellberg","description":"Go library for the World Population API","archived":false,"fork":false,"pushed_at":"2015-10-04T20:07:59.000Z","size":176,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-14T07:11:28.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterhellberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-04T13:28:52.000Z","updated_at":"2024-05-14T18:08:20.000Z","dependencies_parsed_at":"2023-03-13T11:02:58.416Z","dependency_job_id":null,"html_url":"https://github.com/peterhellberg/population","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fpopulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fpopulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fpopulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fpopulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterhellberg","download_url":"https://codeload.github.com/peterhellberg/population/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241773264,"owners_count":20018064,"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-14T13:28:59.922Z","updated_at":"2025-11-29T19:06:19.700Z","avatar_url":"https://github.com/peterhellberg.png","language":"Go","readme":"***Warning: This library is brand new, and should not be considered stable just yet***\n\n# population\n\nGo library for the [World Population API](http://api.population.io/)\n\n[![Build Status](https://travis-ci.org/peterhellberg/population.svg?branch=master)](https://travis-ci.org/peterhellberg/population)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/peterhellberg/population)\n[![License MIT](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/peterhellberg/population#license-mit)\n\n## Installation\n\n    go get -u github.com/peterhellberg/population\n\n## Public API\n\n - **[func NewClient(httpClients ...\\*http.Client) \\*Client](https://godoc.org/github.com/peterhellberg/population#NewClient)**\n - **[func (c \\*Client) DateByRank(sex, country, dob string, rank int) (DateByRank, error)](https://godoc.org/github.com/peterhellberg/population#Client.DateByRank)**\n - **[func (c \\*Client) ListCountries() (CountryList, error)](https://godoc.org/github.com/peterhellberg/population#Client.ListCountries)**\n - **[func (c \\*Client) MortalityDistributionTable(sex, country, age string) (MortalityDistributionTable, error)](https://godoc.org/github.com/peterhellberg/population#Client.MortalityDistributionTable)**\n - **[func (c \\*Client) RankByAge(sex, country, dob, age string) (RankByAge, error)](https://godoc.org/github.com/peterhellberg/population#Client.RankByAge)**\n - **[func (c \\*Client) RankByDate(sex, country, dob, date string) (RankByDate, error)](https://godoc.org/github.com/peterhellberg/population#Client.RankByDate)**\n - **[func (c \\*Client) RankInFuture(sex, country, dob, in string) (RankWithOffset, error)](https://godoc.org/github.com/peterhellberg/population#Client.RankInFuture)**\n - **[func (c \\*Client) RankInPast(sex, country, dob, ago string) (RankWithOffset, error)](https://godoc.org/github.com/peterhellberg/population#Client.RankInPast)**\n - **[func (c \\*Client) RankToday(sex, country, dob string) (RankToday, error)](https://godoc.org/github.com/peterhellberg/population#Client.RankToday)**\n - **[func (c \\*Client) RemainingLifeExpectancy(sex, country, date, age string) (RemainingLifeExpectancy, error)](https://godoc.org/github.com/peterhellberg/population#Client.RemainingLifeExpectancy)**\n - **[func (c \\*Client) Table(country string, year, age int) (Table, error)](https://godoc.org/github.com/peterhellberg/population#Client.Table)**\n - **[func (c \\*Client) TableAllAges(country string, year int) (Table, error)](https://godoc.org/github.com/peterhellberg/population#Client.TableAllAges)**\n - **[func (c \\*Client) TableAllYears(country string, age int) (Table, error)](https://godoc.org/github.com/peterhellberg/population#Client.TableAllYears)**\n - **[func (c \\*Client) TotalLifeExpectancy(sex, country, dob string) (TotalLifeExpectancy, error)](https://godoc.org/github.com/peterhellberg/population#Client.TotalLifeExpectancy)**\n - **[func (c \\*Client) TotalPopulationByDate(country, date string) (TotalPopulation, error)](https://godoc.org/github.com/peterhellberg/population#Client.TotalPopulationByDate)**\n - **[func (c \\*Client) TotalPopulationTodayAndTomorrow(country string) (TotalPopulation, TotalPopulation, error)](https://godoc.org/github.com/peterhellberg/population#Client.TotalPopulationTodayAndTomorrow)**\n\n## Usage\n\n**TotalLifeExpectancy**\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/peterhellberg/population\"\n)\n\nfunc main() {\n\tp := population.NewClient()\n\n\tt, err := p.TotalLifeExpectancy(\"male\", \"Sweden\", \"1983-04-28\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tjson.NewEncoder(os.Stdout).Encode(t)\n}\n```\n\n```js\n{\"sex\":\"male\",\"country\":\"Sweden\",\"dob\":\"1983-04-28\",\"total_life_expectancy\":85.3205032926867}\n```\n\n**ListCountries**\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/peterhellberg/population\"\n)\n\nfunc main() {\n\tp := population.NewClient()\n\n\tlist, err := p.ListCountries()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\n\tjson.NewEncoder(os.Stdout).Encode(list)\n}\n```\n\n```js\n{\"countries\":[\"Afghanistan\",\"Albania\",\"Algeria\",\"Angola\",\"Antigua and Barbuda\",\"Azerbaijan\",\"Argentina\",\"Australia\",\"Austria\",\"The Bahamas\",\"Bahrain\",\"Bangladesh\",\"Armenia\",\"Barbados\",\"Belgium\",\"Bhutan\",\"Bolivia\",\"Bosnia and Herzegovina\",\"Botswana\",\"Brazil\",\"Belize\",\"Solomon Islands\",\"Brunei Darussalam\",\"Bulgaria\",\"Myanmar\",\"Burundi\",\"Belarus\",\"Cambodia\",\"Cameroon\",\"Canada\",\"Cabo Verde\",\"Central African Republic\",\"Sri Lanka\",\"Chad\",\"Chile\",\"China\",\"Colombia\",\"Comoros\",\"Mayotte\",\"Congo\",\"Dem Rep of Congo\",\"Costa Rica\",\"Croatia\",\"Cuba\",\"Cyprus\",\"Czech Republic\",\"Benin\",\"Denmark\",\"Dominican Republic\",\"Ecuador\",\"El Salvador\",\"Equatorial Guinea\",\"Ethiopia\",\"Eritrea\",\"Estonia\",\"Fiji\",\"Finland\",\"France\",\"French Guiana\",\"French Polynesia\",\"Djibouti\",\"Gabon\",\"Georgia\",\"The Gambia\",\"West Bank and Gaza\",\"Germany\",\"Ghana\",\"Kiribati\",\"Greece\",\"Grenada\",\"Guadeloupe\",\"Guam\",\"Guatemala\",\"Guinea\",\"Guyana\",\"Haiti\",\"Honduras\",\"Hong Kong SAR-China\",\"Hungary\",\"Iceland\",\"India\",\"Indonesia\",\"Islamic Republic of Iran\",\"Iraq\",\"Ireland\",\"Israel\",\"Italy\",\"Cote-d-Ivoire\",\"Jamaica\",\"Japan\",\"Kazakhstan\",\"Jordan\",\"Kenya\",\"Dem Peoples Rep of Korea\",\"Rep of Korea\",\"Kuwait\",\"Kyrgyz Republic\",\"Lao PDR\",\"Lebanon\",\"Lesotho\",\"Latvia\",\"Liberia\",\"Libya\",\"Lithuania\",\"Luxembourg\",\"Macao SAR China\",\"Madagascar\",\"Malawi\",\"Malaysia\",\"Maldives\",\"Mali\",\"Malta\",\"Martinique\",\"Mauritania\",\"Mauritius\",\"Mexico\",\"Mongolia\",\"Moldova\",\"Montenegro\",\"Morocco\",\"Mozambique\",\"Oman\",\"Namibia\",\"Nepal\",\"The Netherlands\",\"Curacao\",\"Aruba\",\"New Caledonia\",\"Vanuatu\",\"New Zealand\",\"Nicaragua\",\"Niger\",\"Nigeria\",\"Norway\",\"Federated States of Micronesia\",\"Pakistan\",\"Panama\",\"Papua New Guinea\",\"Paraguay\",\"Peru\",\"Philippines\",\"Poland\",\"Portugal\",\"Guinea-Bissau\",\"Timor-Leste\",\"Puerto Rico\",\"Qatar\",\"Reunion\",\"Romania\",\"Russian Federation\",\"Rwanda\",\"St-Lucia\",\"St-Vincent and the Grenadines\",\"Sao Tome and Principe\",\"Saudi Arabia\",\"Senegal\",\"Serbia\",\"Seychelles\",\"Sierra Leone\",\"Singapore\",\"Slovak Republic\",\"Vietnam\",\"Slovenia\",\"Somalia\",\"South Africa\",\"Zimbabwe\",\"Spain\",\"South Sudan\",\"Sudan\",\"Western Sahara\",\"Suriname\",\"Swaziland\",\"Sweden\",\"Switzerland\",\"Syrian Arab Rep\",\"Tajikistan\",\"Thailand\",\"Togo\",\"Tonga\",\"Trinidad and Tobago\",\"United Arab Emirates\",\"Tunisia\",\"Turkey\",\"Turkmenistan\",\"Uganda\",\"Ukraine\",\"FYR Macedonia\",\"Arab Rep of Egypt\",\"United Kingdom\",\"Channel Islands\",\"Tanzania\",\"United States\",\"US Virgin Islands\",\"Burkina Faso\",\"Uruguay\",\"Uzbekistan\",\"RB-de-Venezuela\",\"Samoa\",\"Rep of Yemen\",\"Zambia\",\"World\"]}\n```\n\n**MortalityDistributionTable**\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"os\"\n\n\t\"github.com/peterhellberg/population\"\n)\n\nfunc main() {\n\tp := population.NewClient()\n\n\ttable, err := p.MortalityDistributionTable(\"male\", \"Sweden\", \"32y\")\n\tif err == nil {\n\t\tjson.NewEncoder(os.Stdout).Encode(table)\n\t}\n}\n```\n\n```js\n{\"mortality_distribution\":[{\"age\":30,\"mortality_percent\":0},{\"age\":35,\"mortality_percent\":0.18301053314006066},{\"age\":40,\"mortality_percent\":0.3940349931720418},{\"age\":45,\"mortality_percent\":0.5754961805614758},{\"age\":50,\"mortality_percent\":0.8954022579575682},{\"age\":55,\"mortality_percent\":1.356341082175081},{\"age\":60,\"mortality_percent\":1.973425541247046},{\"age\":65,\"mortality_percent\":2.9697416640766847},{\"age\":70,\"mortality_percent\":4.56219813009874},{\"age\":75,\"mortality_percent\":7.130513701033149},{\"age\":80,\"mortality_percent\":11.41127901607065},{\"age\":85,\"mortality_percent\":17.125367814281475},{\"age\":90,\"mortality_percent\":21.00234914822359},{\"age\":95,\"mortality_percent\":17.8959645040995},{\"age\":100,\"mortality_percent\":9.52990677877034},{\"age\":105,\"mortality_percent\":2.665309500672174},{\"age\":110,\"mortality_percent\":0.3098041369864069},{\"age\":115,\"mortality_percent\":0.019271048826542916},{\"age\":120,\"mortality_percent\":0.0005743130947408195},{\"age\":125,\"mortality_percent\":9.547634164945612e-06},{\"age\":130,\"mortality_percent\":1.0787857398267798e-07}]}\n```\n\n## License (MIT)\n\nCopyright (c) 2015 [Peter Hellberg](http://c7.se/)\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e \"Software\"), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.\n\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n\u003e NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n\u003e LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n\u003e OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n\u003e WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhellberg%2Fpopulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterhellberg%2Fpopulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhellberg%2Fpopulation/lists"}