Module:Sandbox/Innesw/PopulationFromWikidata-upgrade/doc
| This is a documentation subpage for Module:Sandbox/Innesw/PopulationFromWikidata-upgrade. It may contain usage information, categories and other content that is not part of the original module page. |
| This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
Description
[edit]This module returns population figures for Australian places, getting its data from the Wikidata item linked to the place article. Its most common use is in {{Infobox Australian place}}, where it will return the latest populations for all Australian Bureau of Statistics (ABS) geographic areas relevant to the place.
It can also return a single latest population figure for a specified geography, or a table of all the historic census populations found in the Wikidata.
All returned population figures are referenced - if a population claim in Wikidata does not have a reference, it will not be returned.
The aim of the module is to make it easier to keep population values (and associated references) up-to-date in Australian place articles, both in Infoboxes and in other locations in those articles.
Usage
[edit]The module exposes three functions.
ListForInfobox( type, wikidata, geog, check )
[edit]{{#invoke:PopulationFromWikidata |ListForInfobox |type=t |wikidata=w |geog=g |check=c }}
Returns the lastest populations for all relevant ABS geographies that are available. If there is more than one, they are returned as a bulleted list.
Parameters:
|type=thetypeparameter from {{Infobox Australian place}}. Required.|wikidata=Wikidata ID to override that of the current article. Optional.|geog=Geography abbreviation for a single geography whose population is to be returned. Valid values are ucl, sal, iloc, lga. Optional.|check=any value except <blank> will:- return 'yes' if there would be any population data to return (given the other parameter values), or an empty string if there would not
- not create any references
LatestPopulation( geog, wikidata, year, punc )
[edit]
{{#invoke:PopulationFromWikidata |LatestPopulation |geog=g |wikidata=w |year=y |punc=p }}
Returns the lastest census population for the requested ABS geography.
Parameters:
|geog=Geography abbreviation for a single geography whose population is to be returned. Valid values are ucl, sal, iloc, lga. Required.|wikidata=Wikidata ID to override that of the current article. Optional.|year=Any value except <blank> will cause the output to include the year of the Wikidata population claim. If|year=is not specified, the year is not shown. Optional.|punc=Any value will be placed between the rest of the returned text and the reference number. Usually this will be|punc=.. Optional.
HistoricPopulations( type, wikidata, geog, note1_year, note1_text )
[edit]{{#invoke:PopulationFromWikidata |HistoricPopulations|type=t |wikidata=w |geog=g |note1_year=y |note1_text=txt }}
Returns a table of census populations by year and ABS geography.
Parameters:
|type=thetypeparameter from {{Infobox Australian place}}. Required.|wikidata=Wikidata ID to override that of the current article. Optional.|geog=Geography abbreviation for a single geography whose populations are to be returned. Valid values are ucl, sal, iloc, lga. Optional.|note1_year=,|note1_text=Specify the year, and the text of a note to appear in the table row for that year. Optional.
|note2_year=,|note2_text=,|note3_year=,|note3_text=etc. can be specified.
Categories
[edit]The module adds all articles that use it - including via Infobox Australian place - to Category:Australian_place_articles_using_Wikidata_population_values.
What the module does
[edit]Population sources
[edit]The module is designed to be invoked from the Infobox Australian place template and gathers data from the Wikidata item linked to each article.
This module is only invoked by Infobox Australian place if a population is not manually supplied in that template's |pop= parameter.
Assumptions
[edit]The module works with the following assumptions:
- That all Australian place Wikipedia articles are linked to relevant Wikidata items (true because Canley and 99of9 have done this work).
- Relying on the type field of the Infobox Australian place template being a required field and assuming it always has a value specified.
- We're only considering population values associated with the Australian Bureau of Statistics' defined Australian Statistical Geographic Standard areas.
- That the linked Wikidata item will likely have population statements for multiple Australian Bureau of Statistics geographic areas that encompass the item place.
- Any ranking of population statements in the Wikidata is ignored.
Population selection
[edit]The high level steps of the module work flow are decribed below. There are three major steps in the process of selecting the population figure to return.
Step 1. Check which population claims have enough information to be considered
[edit]As a minimum they are required to have:
- A point in time qualifier date (this helps to choose the most recent population figures).
- An applies to part qualifier value (this states which ABS geography type the population is for and helps choose the most appropriate geographic area for the place article).
- A determination method qualifier item (this specifies if it is a census population figure or a non-census population estimate and helps define the reference components).
- Some reference information (it is a requirement to have something with which to build a reference but more than the minimum is recommended - see § Population data in Wikidata below).
After filtering for these requirements a subset of population claims is carried forward.
Step 2. Check which population claims have the most recent figures for each geography
[edit]Check within the list of claims and find the most recent population figure for each applies to part value, ie: for each applies to part value (UCL, SAL etc) we find the claim with the latest point in time value (2016, 2011 etc).
Step 3. Specify the geography types that can be returned for each place type
[edit]If a geography is specified in the |geog= parameter, only the latest population for that geography will be returned.
If the |geog= parameter is not specified, the possible geographies for the provided |type= are:
| City | Urban Centres and Localities (UCL) |
| Suburb | Suburbs and Localities (SAL) |
| Town | Urban Centres and Localities (UCL), Suburbs and Localities (SAL), Indigenous Locations (ILOC) |
| Settlement | Suburbs and Localities (SAL), Indigenous Locations (ILOC) |
| Locality | Suburbs and Localities (SAL), Indigenous Locations (ILOC) |
| LGA | Local Government Areas (LGA) |
| Region | (none) |
Compile the module output, using only latest claims in specified geographies
[edit]For all possible geographies, the latest claims found will be returned.
If there is only one matching claim, it is simply output:
- 100 (UCL 2021)[1]
If there is more than one claim, they are output as a bulleted list:
- 90 (ILOC 2021)[1]
- 100 (SAL 2021)[2]
References
[edit]The references for actual census data are formatted using the census template for the appropriate year, eg: Census 2021 AUS. All other references use the Cite web template.
The census population figure references take this form: Australian Bureau of Statistics (28 June 2022). "Cosmo Newberry (Indigenous Location)". 2021 Census QuickStats. Retrieved 28 June 2022.
The non-census derived population figure references take this form: Australian Bureau of Statistics (29 March 2022). "Population estimates by SA2 and above, 2001 to 2021 (Greater Capital City Statistical Areas)". Australian Regional Population. Retrieved 28 June 2022.
The references are named: name = refwork .. "_" .. year .. "_" .. appliespart .. "_" .. reftitle. This is long-winded because we are aiming for a unique reference name for each population claim.
Example outputs
[edit]There are some example outputs in the Infobox Australian place Sandbox Test Cases page here.
What it doesn't do - next steps
[edit]There are some issues that we are aware of, and have considered but haven't dealt with yet. These will be tackled in time in collaboration with other place article contributors. (No doubt there are many more to add to the list - please do).
- Some tidying up the output within the infobox:
removing unnecessary bullet points when there's only one itemadd links to information about the relevant Censusadding tooltip descriptionchange geography to abbreviation- adding links to explanations of ABS geographic boundaries (add this info to the Census articles and link to sections there)
- Done. The links are to an ASGS section in Australian Bureau of Statistics.
- Make a table of historic population values (from those available in Wikidata and that meet other module criteria) and test this as a new addition to place articles. As part of possible methods of preserving historic population figures in articles. Possibly a better solution than having multiple old values listed in Infoboxes (eg. Basket_Range,_South_Australia) or having to maintain individually in-text? Not the same idea, but there is a table of historic population values listed in this article).
- Done. Use
{{#invoke:PopulationFromWikidata|HistoricPopulations}}.
- Done. Use
- Figure out the case of two Infoboxes: Jimbour East, Queensland
- Suppress the population figures for protected areas. (eg, no output for type = protected). Yes?
- Done. Populations for
|type=protected, and|type=cadastralare now explicitly suppressed.
- Done. Populations for
- Population density figures need to be computed and added to the Infobox using the same population (and area from corresponding geography) as this module outputs now. With area data uploaded to Wikidata?
- Test that city rank can still be displayed in the Infobox if population coming from the module.
- Done, but not in this module - done in {{Infobox Australian Place}}
- How to integrate (merge correctly) named references from the module with those used in-text. And how to retain historic population values (and references) as the Infobox population automatically updates with the most current figures. The module produces named references that are unique to the population value, but there are currently reference merging bugs associated with references from templates (and modules).
- Done.
- Should we change it so that pop2 still displays even if pop is replaced by the module population? So you can have both the automated population and a specific other population that's relevant to the article for some reason.
- Done, but not in this module - done in {{Infobox Australian Place}}
- Add some more documentation to Wikipedia:WikiProject Australian places/Population data.
- Figure out interactions with the Coord template that's used in the majority of Australian place articles. The Coord template takes a population argument and uses that to determine the display scale of the Coordinates interactive map. Should we make an equivalent module (similar to this one) to bring place coordinates (with appropriate map zoom scales) from Wikidata to the Infobox Australian place template? Then the coordinates (and map scale) can be kept up-to-date with Wikidata. This would require parallel work to determine most appropriate place coordinate definition (eg centroid? of which geographic area?) so coordinates can be bulk imported to Wikidata? Or just rely on people adding the coordinates values to Wikidata manually but cut out the need to use the Coord template to set map zoom scale? Or keep using the Coord template but give it the appropriate population value as selected by (a modified version) of this PopulationFromWikidata module.
- Connect Aboriginal and Torres Strait Islander community Wikidata items with ABS ILOC IDs so ILOC population counts can be uploaded in bulk. Will then need to revisit the ILOC vs SAL preferencing because for some towns ILOC will be more appropriate than SAL (due to geographic area covered).
- Need to revisit mapping of
|type=regionto ABS geographies. Maybe they should be mapped to SA3s? Eg: Kimberley region article Also, need to update this article and other equivalents. - Discrepancy with places with zero population, such as Essendon Fields (Q5399482):
- In QuickStats it says: "No information can be provided because the area selected had no people or a very low population in the 2021 Census."
- But it does have data in Wikidata (population 13, for SAL20886, which is what is in the DataPack).
- This means that the reference URL ends up not backing up the displayed population figure.
- There may be a difference in how this is handled between 2016 and 2021. For example, Savannah (Q55771929) has zero population and doesn't show in either 2016 or 2021 QuickStats — but Tyenna (Q7859816) had 3 people in 2016 (shown in QuickStats) and 4 people in 2021 (not shown in QuickStats). Both places have both figures in the DataPack.
What if the outputs are incorrect
[edit]All the references produced by this module are followed by an Edit at Wikidata pencil icon which links to the relevant Wikidata item (and specific population claim). This is where people should go to fix any errors in the population figure outputs or references. See next section for lists of what should ideally be included in a Wikidata population claim.
Population data in Wikidata
[edit]Wikipedia - Wikidata links
[edit]In parallel to development of this module User:99of9 and User:Canley have been working on ensuring all Australian place Wikipedia articles are linked to corresponding Wikidata items (describing that same place). This has largely been done. This enables the use of this module.
Census data
[edit]Population data has historically been manually entered to individual Wikidata items. Recently (since ~2017) User:99of9, User:Canley and others have used QuickStatements to do bulk imports of population data from Australian Bureau of Statistics datasets. Part of developing this module was to refine the list of metadata (qualifiers and reference fields) that should be imported alongside the population values.
As at July 2022 the first release of the 2021 census population data has been uploaded for the geographic areas relevant to Australian place Infoboxes. This includes data for Suburbs and Localities (SAL), Indigenous Locations (ILOC) and Local Government Areas (LGA). The Urban Centres and Localities (UCL) data is due to be released in October 2022.
The module requires these qualifiers and reference components to have values in the Wikidata population claim.
- applies to part
- point in time
- determination method
- reference: reference URL
- reference: title
- reference: published in
- reference: retrieved
- reference: Australian Statistical Geography 2021 ID (optional)
An example of a Wikidata item with a correctly filled 2021 population claim (using Census data) is:d:Q2821571#P1082.
Non-census data
[edit]Bulk uploads have been done for census data. They have not been done for between-census estimated residential population (ERP) or Data by Region figures, for example. These estimates are useful for capital cities, LGAs and regions.
The module requires that non-census population claims have these components:
- applies to part
- point in time
- determination method
- reference: reference URL
- reference: title
- reference: published in
- reference: retrieved
- reference: publication date
- reference: Australian Statistical Geography 2021 ID (optional)
An example of a Wikidata item with a correctly filled 2021 estimated resident population claim (not the other population claims) is:d:Q11568#P1082. An example of a Wikidata item with a correctly filled 2020 LGA Data by Region population claim (not the other population claims) is:d:Q704257#P1082.
Who made the module
[edit]Wikimedia Australia initially designed this project to coincide with the first release of the 2021 census data (in June 2022). This module was created as part of a funded project with work done by MaiaCWilliams in collaboration with (really...HUGE amounts of help from) Samwilson, 99of9 and Canley. The project was coordinated by tenniscourtisland.
It is an ongoing project and we will continue to refine the module. Of course anyone is welcome to contribute!
Head to the Module_talk:PopulationFromWikidata page if you have anything to discuss.
We wrote a summary of the project for the Wikimedia Australia blog here.
The 2026 upgrade of the module was written by Innesw.