User:Zamboniroadkill/code explore sandbox Covid19 class

code from per capita template to dissect with the purpose of copying it for the US states COVID project:
{{safesubst: #switch:{{{country}}}

{{round|{{#expr: 1000000*{{formatnum:{{#invoke:WikidataIB|getValue|ps=1|qid=Q87768605|P1603|list=p-1}}|R}}/{{formatnum:{{#invoke:WikidataIB|getValue|ps=1|qid=Q889|P1082|list=p-1}}|R}} }} |0}}
 * Afghanistan		=

{{round|{{#expr: 1000000*{{formatnum:{{#invoke:WikidataIB|getValue|ps=1|qid=Q88164033|P1603|list=p-1}}|R}}/{{formatnum:{{#invoke:WikidataIB|getValue|ps=1|qid=Q954|P1082|list=p-1}}|R}} }} |0}}
 * Zimbabwe		=

From the template info found here: https://en.wikipedia.org/wiki/Template:COVID-19_pandemic_data/Per_capita/case_calculator

Initial notes:
basic formula is 1,000,000*confirmed cases/population in that country to give cases per million. The number is rounded to 0 decimal places (whole number)

The confirmed cases is given by: 0 Run above code example: 0

The population in the country is given by: 0 Run above code example:0

formatnum | R probably makes it a real number


 * 1) invoke is probably what allows them to link to the WikidataIB sister project.

Wikidata appears to be a sister project, not sure what the IB means https://www.wikidata.org/wiki/Wikidata:Introduction

getValue appears to be the command to get that data

qid appears to be the unique data identifier. In addition to the start, |Zimbabwe identifier, the qid is the main thing that changes between the different named countries.

Pxxxx(P1082 and P1603) may refer to a specific page, etc. that classifies the data.


 * 1) invoke is probably what allows them to link to the wikidata thingy. we

Preliminary Analysis:
If we can find the case count and population data on the wikidata thingy, we can substitute the appropriate qid and pxxx identifiers into this template and make it apply for the different states.

WikiData
-Each item has its own page—where all the data about it is collected—and a unique identifier. This identifier always looks similar to Q###. While useful for machines and for representing knowledge in a lot of different languages, this identifier is not very human-friendly.

-

information derived from
07/03/20 checked wikidata introduction page: 07/03/20 took "item" tour:

Useful pieces of information:
Open comment:

example: