Template talk:PH wikidata

Observations
This is great, but some observations: -- Unbuttered parsnip (talk) mytime= Fri 09:50, wikitime=  01:50, 3 April 2015 (UTC) I must admit, I could never work out what is supposed to do. If it permanently transcludes the outcome, doesn't that rather lose the whole point of wikidata, for instance with population? To be honest, I don't think it at all right to hold leader_name in wikidata, not unless the entire council is also held. It makes no point to me to obtain the mayor's name from one source, but all the others are hard-coded into the invocation. I've never actually come across any use of the wikidata property. I agree about lists such as establishment_date(s), but that is a wikidata problem that is not at the moment surmountable (or doesn't appear so). Basically there is a single property "inception" which can have multiple instantiations. Nor is it currently possible to extract from the list one by one. I could envisage a module to do that, but don't have the knowledge to write it. Similarly, I would like to be able to take the csv list and form it into something like a collapsible list á la PH Town Council. All I've done so far is work out a way to find out how many elements are in the list – I don't know (is there a way?) how to pass the elements as pipe-separated variables to another template. There seem to be a couple of FOR...LOOP templates, but they don't seem entirely appropriate. The use of the second parameter would be to modify the output style (csv, ubl, etc.), rather than modify the content. One more thing – I have requested a few new properties, such as electorate and income classification. I am currently working on a template which takes the spreadsheet provided by Comelec and returns the voter numbers for a PSGC (municipality level or greater). The figures also contain a lot, but not 100%, of figures for male and female, which makes an interesting demographic. My point is that I thought I could incorporate that into this template, even though it's not actually wikidata (yet). That would save a blanket update later when it is. Unbuttered parsnip (talk) mytime= Sat 08:49, wikitime=  00:49, 4 April 2015 (UTC)
 * 1) Property:P150 contains administrative territorial entity  should contain a list.  It contains a type (e.g.Purok) only by my mistake.
 * 2) I think the inclusion of property 481 – Palissy identifier = identifier in the Palissy database of moveable objects of French cultural heritage within area_code is not right – this is a Philippine template, nothing to do with French.
 * 3) Some other likely-properties, e.g. Income classification, are waiting on wikidata action.
 * will add tracking to find incorrect uses of P150 and P481. note that we should be careful that we don't use wikidata in cases where it would be awkward or problematic.  for example, getting the name of the current mayor from wikidata, but setting the party affiliation here.  when the name changes, the affiliation won't change as well.  another is pulling the date of foundation from wikidata, but setting the labels here.  if the dates are changed on wikidata (e.g., inserting another founding date or removing one), then the labels will be out of sync.  also, 'br' delimited lists for the data with 'br' delimited lists for the labels is bad for wp:accessibility. Frietjes (talk) 15:23, 3 April 2015 (UTC)
 * fixed all P150 and P481, note that we need to have a default for the leader titles. otherwise, if the property doesn't exist on wikidata, the values set for leader_name won't show in the infobox. Frietjes (talk) 16:34, 3 April 2015 (UTC)
 * Thanks for a brilliant piece of work. Sorry you got lumbered like this – Sistine Chapel V ceiling painting!  I suppose it's better sooner than later, and had to be done anyway.

PH wikidata used in Template:Commons category (and similar templates)
Hello

using the template PH Wikidata like this leads to the fact that the corresponding page is listed in Category:Commons category template with no category set. --Robby (talk) 11:13, 31 January 2016 (UTC)
 * Robby, which page? I would imagine that's only the case if the property is not set at wikidata.  we could make the template default to the article name when the property isn't set at wikidata. Frietjes (talk) 15:51, 22 February 2016 (UTC)
 * Hello Frietjes, there is for instance the page Alicia, Bohol. --Robby (talk) 18:26, 22 February 2016 (UTC)
 * Robby, I just added the commons category link to [//www.wikidata.org/wiki/Q404403 the wikidata page] and now it's not in the category. I don't really see being in Category:Commons category template with no category set as necessarily a bad thing, since by default   uses the wikidata or the pagename, whichever is not blank.  but, it is good to make sure that the commons category is in the wikidata, so perhaps we could make a way to track when this template is being invoked to get the commons category and returns nothing? Frietjes (talk) 18:40, 22 February 2016 (UTC)
 * Frietjes, the aim of my post here was to make aware of this behaviour. Indeed the category Category:Commons category template with no category set should (according to my understanding) help to find out pages where  is used without parameters and where the author has not verifed wheter the according category is existing on Commons. According to my conviction we should avoid to have links on wikipedia whose target does not exist. --Robby (talk) 18:57, 22 February 2016 (UTC)
 * Robby, you can now find the offending pages with this search. Frietjes (talk) 00:51, 24 February 2016 (UTC)

Use of this template
(pinging, as I see you've made many edits to the template): Hello all watchers! I see the template used in the Philippine province articles, and each use where the capital is not at the base name (for example, the capital of Catanduanes is Virac, which is at Virac, Catanduanes) is causing a link to the incorrect page in the article (Virac is a disambiguation page, not the article for the city). Can anyone take a look at this? Thanks in advance! -Niceguyedc Go Huskies! 08:08, 1 May 2016 (UTC)
 * Niceguyedc, fixed, thank you for noticing. Frietjes (talk) 13:09, 1 May 2016 (UTC)

Population_as_of
Hi When adding the 2015 census data to Wikidata, the field   returns the word "census" twice, see Anda, Bohol. I can't see where this error creeps in. Can you look into this? Thanks. -- P 1 9 9 ✉ 14:52, 20 May 2016 (UTC)
 * User:P199, fixed, there was an inconsistency in how data items with multiple entries were being parsed. Frietjes (talk) 15:13, 20 May 2016 (UTC)
 * Thanks for the quick fix. -- P 1 9 9 ✉ 15:15, 20 May 2016 (UTC)

Image_skyline
How to use image_skyline when it returns two values and we need only one, for example for Manila infobox if one wanted to use it there as image_skyline?

What if one wanted to use second image for wide image template, in same example I've mentioned above?

Btw, could someone tell me how to add translation for "Metro Manila" on Wikidata in order for it to get translated in map caption generated by ? /I ask this for other Wikipedia I'm writing this article on./ --Obsuser (talk) 13:19, 19 September 2016 (UTC)
 * Obsuser, the multiple image problem should be fixed now. you can set the "priority" for the images in wikidata.  as far as the caption translation goes, I am pretty sure you have different values for the caption depending on the language.  it's just up to the code which grabs the caption to grab the correct language.  usually it uses the site default language unless told otherwise (see module:wikidata for examples). Frietjes (talk) 14:07, 19 September 2016 (UTC)
 * Obsuser, I just checked and if you click on 'edit' for the image, then there should be a button for 'add qualifier'. if you click on that, you can select 'legend' and enter a legend with the corresponding two or three letter language code.  I just did this for Manila, and set the priority for the montage. Frietjes (talk) 14:18, 19 September 2016 (UTC)
 * OK, image is now good. Or not: Caption in Cyrillic script is cut off just after a few words – maybe due to the "weight" of the script...
 * Still don't know how to add translation for Metro Manila in "located next to body of water" where it says English for me when I change language on Wikidata (for Serbian it reads verbatim енглески right to the "Metro Manila" in "се налази у" property for "српски / srpski" chosen language). Or, maybe, article needs to exist on sr.wiki in order to get this translated (after Serbian article for Metro Manila is linked on Wikidata to Q13580)?
 * Thank you for fast response, however. --Obsuser (talk) 14:44, 19 September 2016 (UTC)
 * I've tried to make caption working but no success. Don't know why it cannot display values for P2096 comma separated (although, even if it would work that way, it would be ugly solution). For English caption, it is not possible to link Manila Bay because then ]] are chopped off from Tondo Church...--Obsuser (talk) 15:24, 19 September 2016 (UTC)
 * Obsuser, there probably is a limit on the total length of the caption. if there are multiple entries for one property (for example more than one image), then the query returns all of them.  modules like Module:Wikidata then turn that list into comma separated entries, but in wikidata they are separate entries.  if you are having problems with something getting cut off, you may have better luck asking at WikiData site, or at Module talk:Wikidata, or at WP:VPT.  Frietjes (talk) 15:39, 19 September 2016 (UTC)

Parser function error
At Pamilacan, the two uses of are returning a figure of 1,422±0. Presumably because of the non-digit character ±, the occurrence in Infobox islands is causing an error message to appear in the "Pop. density" field. I'm too ignorant in template-fu to figure out what the problem is. Can anyone help? Deor (talk) 22:37, 17 November 2016 (UTC)
 * I removed ±0 on Wikidata so that convert template get parsable number. --Obsuser (talk) 22:48, 17 November 2016 (UTC)


 * I've just encoutered this error in Manila article too. It is wierd because upper and lower bounds (± values) seem to be added on Wikidata by themselves, thus causing conversion errors in articles. Someone changed something somewhere and it causes errors...--Obsuser (talk) 23:27, 17 November 2016 (UTC)

There are over 20 articles in Category:Convert errors and looking at a couple of them suggests they are due to this issue. In any of the articles, search for "convert:" (with colon), then hold the mouse over the "invalid number" message. That shows a popup mentioning ±. In principle, convert could ignore ±0 or possibly even ±12.3, but it might be better if Wikidata templates omitted it? @Frietjes: you have been working on this template; what do you think? Johnuniq (talk) 01:44, 19 November 2016 (UTC)

I had forgotten that convert can handle some Wikidata properties. For example, Cavite is and its area can be found from  using: If editing Cavite, the qid would be omitted (just ).
 * → undefined undefined

I do not understand PH wikidata. For example, the  item includes the following (split into separate lines, and with safesubst omitted):

What is the regex doing? If P1082 returned " ", the result of the replace would be " ". What is that used for?

The regex for cleaning is " " and omitting the space would remove the ±0. Perhaps Wikidata used to output a space there? Johnuniq (talk) 05:40, 19 November 2016 (UTC)

There are now 230 articles in Category:Convert errors. One option would be to replace the following in affected articles:

with

I think that will do the same job and it appears to work, and it would remove some of the errors. Or some tweaking of this template could remove "±0" but that would be pretty ugly as a lot of items potentially need that treatment. There should be some more robust way of extracting wikidata using a module, and perhaps some of convert's code would be helpful. Johnuniq (talk) 09:16, 19 November 2016 (UTC)


 * I think  regex mentioned above is for fixing comma separated not needed imports of properties with multiple defined values on Wikidata of which none has been marked as with preferred rank (although we need only one). If P1082 returned "1,234, junk", the result of the replace I guess would not be "4" but "1". --Obsuser (talk) 11:09, 19 November 2016 (UTC)
 * Johnuniq, Obsuser, Deor, I fixed it by filtering out the ±0 with string replacement. the regexp for cleaning the area removes the " square kilometres" after the number.  The   means anything that is not a digit ([//www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Character_class see this section of the LUA manual]).  the regexp for cleaning the population is when there are multiple population figures for multiple years, but none with a preferred rank.  I had added some tracking to check when this was necessary so that we could go into wikidata and add a preferred rank.  I have now augmented these string replacements to include removal of the ±0.  in my opinion, the best option would be to be able to tell Module:Wikidata to return the bare number, without the uncertainty and without the units.  or, in the case that there are units, ask it to return the bare number in the requested units.  then, Module:Wikidata could call convert if the units requested don't match the units returned from wikidata. Frietjes (talk) 14:32, 19 November 2016 (UTC)
 * Thanks for the fix. I only vaguely recall Module:Convert/wikidata but I think I looked at Module:Wikidata at the time and found it was determining the text representation of the value (intended for display). As I recall, I made Module:Convert/wikidata use a different procedure to get the bare value, I hope with the highest rank. I did that because the human-readable value is not what is wanted, and its format is certain to change as people fiddle with Wikidata. If my recollection is correct, Module:Wikidata might benefit from some tweaks. Johnuniq (talk) 07:12, 20 November 2016 (UTC)

CA wikidata
Hi. Thanks for all your work on this template. Can you make a template like this one, but tailored for Canadian infoboxes? Maybe call it CA wikidata. Thanks in advance. -- P 1 9 9 ✉ 20:32, 26 April 2017 (UTC)
 * P199, sure. we just need a list of commonly used property numbers to get started.  I am assuming that we could probably start with the list used here and remove/add as needed. Frietjes (talk) 21:13, 26 April 2017 (UTC)
 * - I think would better to move into two groups: one is those PH-only; and the others are common. Then obvious only the PH-only ones who need to be CA-only. 112.198.71.216 (talk) 07:58, 14 May 2017 (UTC)
 * - it also needs to work on VN wikidata and TH wikidata (etc.) – 82.203.24.241 (talk) 09:52, 1 June 2017 (UTC)

Timezone
The new timezone function is causing Module:String errors. Not sure what's wrong with it. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125; to reply to me 09:40, 10 July 2017 (UTC) to reply to me 13:42, 10 July 2017 (UTC) to reply to me 13:48, 10 July 2017 (UTC)
 * Jc86035, probably fixed now. you can't gsub an empty string. Frietjes (talk) 13:01, 10 July 2017 (UTC)
 * Thanks. Upon closer inspection it seems to be using qualifier of Module:Wikidata incorrectly, and it's supposed to call data for another item when the module doesn't actually support doing that . In any case it could just be replaced with hard-coded values since the entire country has the same time zone. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * Jc86035, go ahead and change it, or change it back to just using 'property:P2907'. I don't have an article for debugging it at hand at the moment. Frietjes (talk) 13:45, 10 July 2017 (UTC)
 * Try Cebu City. The module doc says calling data from another item (§ Arbitrary Access) is expensive, so I'm not sure if it should be added here. Jc86035 (talk) Use &#123;&#123;re&#124;Jc86035&#125;&#125;
 * Jc86035, okay, done. Frietjes (talk) 13:52, 10 July 2017 (UTC)

template:PH wikidata (again)
There are several things wrong about but I can't change it myself:

1 settlement-type has been changed for some cities. Their type has been changed to (by  around 15 aug 2017). So the template needs changing to add this type. It may be a useful time to add further settlement-type though hopefully there wouldn't be any use (ever!). Similarly, there may be a new type "independent city" to consider, although is hasn't been made yet.

2 several parameters have had the underlying wikidata changed, without any document: In Philippines at least, there is another climate measure, Coronas Climate Types, whose values are 1 to 4, usually in roman numerals.
 * language have changed of use from to  (by  around 23 jul 2017)
 * name get the wrong value (by around 8 sep 2017)
 * diocese changed from to
 * climate_type has changed from undefined to {{font|font=Courier new|text= {{{{safesubst:#invoke:Wikidata|getValue|P2564|FETCH_WIKIDATA}} }} (by around 23 jul 2017), and changed value of {{para|climate_title}}.   In addition, most places municpalities or cities (in Cebu at least) have been given two values, e.g. {{nowrap|{{Q|Q209531}}}} as well as {{nowrap|{{Q|Q135712}}}}.
 * There has been no documentation at all, neither at Template talk:PH wikidata nor at any Edit summary.

3 the use of {{Q|P194}} doesn't seem right. Not many places have got one, but those who do have been a given unique values, e.g. Alcantara, Cebu has {{Q|Q22443277}}. I think these are completely wrong. I think {{Q|P31}} should have a value of e.g. {{Q|Q7417956}} (for municipalities), {{Q|Q7417960}} for cities, etc. I don't think unique values like this should be put in wikidata. Currently, {{para|government_type}} is taken as text via {{Q|P31}}. Maybe this should be change to {{Q|P122}} and {{Q|Q7417956}} etc.

(Too many editors go for OR rather than SECONDARY.

Also of course, live templates (or anything live) should not be used as a sandbox.)

4 I think should be used for other infoboxes as well as {{tlx|Infobox settlement}}. I would like better used of: (see {{cite book }})
 * {{tlx|Infobox airport}} including some new items needed for Philippines airstrips
 * title    = Doc 8400, Procedures for Air Navigation Services - ICAO Abbreviations and Codes
 * isbn     = 978-9292316266
 * edition  = Eighth
 * date     = 2010
 * publisher = ICAO
 * for e.g. Hours code HJ / HN / HO etc.
 * Services FSS Flight service station etc.
 * Lighting PCL Pilot-controlled lighting etc. (Small airstrips, e.g. Siquijor Airport, have no lights at all.)


 * {{tlx|Infobox lighthouse}}
 * add items
 * {{para|focalheight}} {{Q|P2923}}
 * {{para|range}} {{Q|P2929}}
 * {{para|characteristic}} {{Q|P1030}}
 * {{para|height}} {{Q|P2048}}
 * {{para|NGA}} {{Q|P3563}}
 * {{para|ARLHS}} {{Q|P2980}} etc.
 * adds new parameter {{para|light sector}} {{Q|P3922}} to add to {{tlx|Infobox lighthouse}}

5 {{tlx|DILG detail}} has to change similarly to {{tlx|PH wikidata}} (but less)

Sorry this message is so long. 49.145.128.113 (talk) 02:26, 21 January 2018 (UTC)

Sorry there was another problem I forgot before.

6 the problem with {{para|coordinates}} is that it makes an error if there is more than one use. I think it should be corrected:
 * should be changed to


 * so that sub-para should be {{para|display|i}}


 * 49.145.128.113 (talk) 10:14, 21 January 2018 (UTC)

Problems
Could someone please look into those? Thanks. -- Radiphus  11:34, 19 February 2018 (UTC)
 * In Flora, Apayao  links to File:Ph locator apayao flora.png, Ph locator apayao flora.png instead of File:Ph locator apayao flora.png.
 * In Silvino Lobos, Northern Samar  links to File:Ph locator northern samar silvino lobos.png, Ph locator northern samar silvino lobos.png instead of File:Ph locator northern samar silvino lobos.png
 * Someone has fixed it. Thanks again. -- Radiphus  11:42, 19 February 2018 (UTC)


 * Hi Radiphus it's because there was duplicate entries added on wikidata, you can clear these errors by deleting the duplicate like this and doing an edit/save on the article. Cheers KylieTastic (talk) 11:44, 19 February 2018 (UTC)

Elevation metre/meter
Some articles using this template have been broken by a change in Wikidata. For example, Capitancillo Island has:
 * elevation m =

and in the article gives "4.5 meter". The unit was recently changed from "metre" (which this template expects) to "meter". I raised the issue here but whatever the outcome of that, the template is too fragile. The template tries to remove any uncertainty and any unit text but it only looks for "metre". There probably should be a module that cleans value/units from Wikidata because adding yet another #invoke:String|replace is most unappealing. Hmm, there probably is a module which would just get the plain value without any dependency on decorations that may be returned by #property, but would that be much more inefficient than #property? Thoughts? @RexxS: Do you want to offer an opinion? Johnuniq (talk) 03:07, 28 October 2018 (UTC)
 * Johnuniq, I fixed it for now, but I agree there must be a better way to do this. looking at Template:Infobox telescope, it looks like we can use  ?  if this is safe, then we can use


 * elevation_m = m m
 * elevation_ft = ft ft
 * we want only one of  and   to be non-blank since the infobox should do the rest.  so, if the wikidata elevation is in ft, we want m to be blank and ft to have the elevation in ft.  if the wikidata elevation is in m, we want ft to be blank and m to have the elevation in m. Frietjes (talk) 17:10, 28 October 2018 (UTC)
 * There is a stipulation in Wikidata that the quantity stored should be in feet, metres or kilometres. But it actually might be found in miles or even inches because there's nothing stopping anyone from using whatever units they want to. See d:Wikidata:Database reports/Constraint violations/P2044 for the statistics. So how robust do you want the template to be? Do you want to cope with any possible length unit or simply fix the errors on Wikidata when we spot them?
 * Using WikidataIB we have some choice on what is displayed. We could get:
 * for, :
 * for, :
 * for, :
 * We could use wd or  to fetch just the units and switch on that:
 * But that still suffers from vulnerability to changes in labels on Wikidata.
 * The only other option I can think of is that I could add a feature into Module:WikidataIB to pass the retrieved quantity and its units through the convert template internally and rely on the default conversions? Then we'd only have one field for elevation. Would that be a usable solution? --RexxS (talk) 21:10, 28 October 2018 (UTC)
 * Thanks very much Frietjes and RexxS for this info. I will need some time to slowly digest it. I had a vague recollection that convert could do something clever but had forgotten the details. I see that input=P2044 causes convert to get the value and the unit (based on its Qid code, not label), then convert that. Taking the default output unit is easiest but may not always be satisfactory. Convert uses getEntity which I believe is a lot of overhead compared with getting a few properties. OTOH getEntity would be for the current page and so is probably cached. Wikidata is complex! Johnuniq (talk) 07:03, 29 October 2018 (UTC)
 * I've implemented a true/false for getValue in Module:WikidataIB. It relies on using the default conversion, so we get these results:
 * For the of  we would get:
 * Using getEntity will always take more resources than getBestStatements, although as you say it's not an expensive call if it's the current page. A lot of the older modules need to be re-written to use getBestStatements or getAllStatements to reduce overhead and to allow en-wiki watchlists to track only those Wikidata changes that affect the properties used in the en-wiki article. If you check the "Parser profiling data" by previewing this section, you'll see Expensive parser function count 3/500, which are the three wd calls I used earlier.  --RexxS (talk) 14:25, 29 October 2018 (UTC)
 * RexxS, thank you. how do I get the elevation as a plain number in meters? Frietjes (talk) 14:40, 29 October 2018 (UTC)
 * If you break down the task into steps, you first recognise that the quantity stored in Wikidata can be in any units:
 * So you need to convert that into metres by separating amount and units, then passing them to cvt and finally extracting the plain number of metres. I've written a little routine to do that:
 * I haven't tested it thoroughly, but it might be adequate for what you want. --RexxS (talk) 17:10, 29 October 2018 (UTC)
 * RexxS, seems complicated. I would think that it could all be done by convert, if I use   I get what I want, but it requires two calls to convert.  Frietjes (talk) 18:01, 29 October 2018 (UTC)
 * . Sure, if you don't mind making two calls to Wikidata to fetch the same thing twice, just using the number from one call and the units from the other. I thought you were perhaps trying to avoid that. --RexxS (talk) 18:15, 29 October 2018 (UTC)
 * , yes, but I see no reason why this can't be done with one call to convert. Frietjes (talk) 18:17, 29 October 2018 (UTC)
 * You can program any module to do whatever you want, but I'm not sure what the use would be for the bare number of metres (just one unit out of so many). Most modules tend to be general-purpose and you sometimes have to bring two general-purpose modules together in a template to get a specific behaviour for a single case. --RexxS (talk) 18:31, 29 October 2018 (UTC)
 * , the need for the bare number in metres is the entire basis for this thread. we already have   &rarr; 29,029 ft and   &rarr; undefined undefined.  if we could combine these two features, into   we would have something.  but, right now this only works if the wikidata entry is in ft, ignoring the 3.  Frietjes (talk) 18:47, 29 October 2018 (UTC)
 * I've implemented a true/false for getValue in Module:WikidataIB. It relies on using the default conversion, so we get these results:
 * For the of  we would get:
 * Using getEntity will always take more resources than getBestStatements, although as you say it's not an expensive call if it's the current page. A lot of the older modules need to be re-written to use getBestStatements or getAllStatements to reduce overhead and to allow en-wiki watchlists to track only those Wikidata changes that affect the properties used in the en-wiki article. If you check the "Parser profiling data" by previewing this section, you'll see Expensive parser function count 3/500, which are the three wd calls I used earlier.  --RexxS (talk) 14:25, 29 October 2018 (UTC)
 * RexxS, thank you. how do I get the elevation as a plain number in meters? Frietjes (talk) 14:40, 29 October 2018 (UTC)
 * If you break down the task into steps, you first recognise that the quantity stored in Wikidata can be in any units:
 * So you need to convert that into metres by separating amount and units, then passing them to cvt and finally extracting the plain number of metres. I've written a little routine to do that:
 * I haven't tested it thoroughly, but it might be adequate for what you want. --RexxS (talk) 17:10, 29 October 2018 (UTC)
 * RexxS, seems complicated. I would think that it could all be done by convert, if I use   I get what I want, but it requires two calls to convert.  Frietjes (talk) 18:01, 29 October 2018 (UTC)
 * . Sure, if you don't mind making two calls to Wikidata to fetch the same thing twice, just using the number from one call and the units from the other. I thought you were perhaps trying to avoid that. --RexxS (talk) 18:15, 29 October 2018 (UTC)
 * , yes, but I see no reason why this can't be done with one call to convert. Frietjes (talk) 18:17, 29 October 2018 (UTC)
 * You can program any module to do whatever you want, but I'm not sure what the use would be for the bare number of metres (just one unit out of so many). Most modules tend to be general-purpose and you sometimes have to bring two general-purpose modules together in a template to get a specific behaviour for a single case. --RexxS (talk) 18:31, 29 October 2018 (UTC)
 * , the need for the bare number in metres is the entire basis for this thread. we already have   &rarr; 29,029 ft and   &rarr; undefined undefined.  if we could combine these two features, into   we would have something.  but, right now this only works if the wikidata entry is in ft, ignoring the 3.  Frietjes (talk) 18:47, 29 October 2018 (UTC)
 * So you need to convert that into metres by separating amount and units, then passing them to cvt and finally extracting the plain number of metres. I've written a little routine to do that:
 * I haven't tested it thoroughly, but it might be adequate for what you want. --RexxS (talk) 17:10, 29 October 2018 (UTC)
 * RexxS, seems complicated. I would think that it could all be done by convert, if I use   I get what I want, but it requires two calls to convert.  Frietjes (talk) 18:01, 29 October 2018 (UTC)
 * . Sure, if you don't mind making two calls to Wikidata to fetch the same thing twice, just using the number from one call and the units from the other. I thought you were perhaps trying to avoid that. --RexxS (talk) 18:15, 29 October 2018 (UTC)
 * , yes, but I see no reason why this can't be done with one call to convert. Frietjes (talk) 18:17, 29 October 2018 (UTC)
 * You can program any module to do whatever you want, but I'm not sure what the use would be for the bare number of metres (just one unit out of so many). Most modules tend to be general-purpose and you sometimes have to bring two general-purpose modules together in a template to get a specific behaviour for a single case. --RexxS (talk) 18:31, 29 October 2018 (UTC)
 * , the need for the bare number in metres is the entire basis for this thread. we already have   &rarr; 29,029 ft and   &rarr; undefined undefined.  if we could combine these two features, into   we would have something.  but, right now this only works if the wikidata entry is in ft, ignoring the 3.  Frietjes (talk) 18:47, 29 October 2018 (UTC)
 * , yes, but I see no reason why this can't be done with one call to convert. Frietjes (talk) 18:17, 29 October 2018 (UTC)
 * You can program any module to do whatever you want, but I'm not sure what the use would be for the bare number of metres (just one unit out of so many). Most modules tend to be general-purpose and you sometimes have to bring two general-purpose modules together in a template to get a specific behaviour for a single case. --RexxS (talk) 18:31, 29 October 2018 (UTC)
 * , the need for the bare number in metres is the entire basis for this thread. we already have   &rarr; 29,029 ft and   &rarr; undefined undefined.  if we could combine these two features, into   we would have something.  but, right now this only works if the wikidata entry is in ft, ignoring the 3.  Frietjes (talk) 18:47, 29 October 2018 (UTC)

okay, it looks like this works, not sure what I was doing wrong before:
 * undefined undefined or in metres: undefined undefined or in ft: undefined undefined
 * undefined undefined or in metres: undefined undefined or in ft: undefined undefined
 * undefined undefined or in metres: undefined undefined or in ft: undefined undefined
 * Frietjes (talk) 18:52, 29 October 2018 (UTC)
 * Are plain numbers needed? Convert (Module:Convert/wikidata) fully analyses the Wikidata property and works on the Qid codes for each unit—any labels are ignored so metre/meter/whatever is not relevant. Convert also uses its own cache of unit codes (Module:Convert/wikidata/data) so it immediately knows that Q11573 is metre/meter. An interesting test of the cache is here—that shows that since 6 July 2017 there have been 31 changes to unit labels but no other problems. Those label changes are not relevant for convert. Surely a solution based on calling convert once can be found, even if convert has to be tweaked. Johnuniq (talk) 02:35, 30 October 2018 (UTC)
 * Johnuniq, see [//en.wikipedia.org/w/index.php?title=Template%3APH_wikidata&type=revision&diff=866335579&oldid=864240484 this change] which appears to be working and is an improvement over the prior code. you are correct that we are still calling convert twice: once here and once through the infobox. the only ways that I know to fix that problem is to deprecated/remove the elevation_m and elevation_ft parameters and have elevation instead with the infobox calling something like infobox person/height.  optionally, the infobox person/height and infobox person/weight could be absorbed into a more generic module  or as part of convert . Frietjes (talk) 13:49, 30 October 2018 (UTC)
 * Thanks, I'm still contemplating the theory while you have fixed the problem. I was thinking that  would be needed but don't know what would be involved in implementing that. Not that it matters but a plain   would be fine instead of   because convert will either return an empty string (if something went wrong) or will replace   with two parameters, a number and a unit code, before doing the conversion. You probably know that. Johnuniq (talk) 02:57, 31 October 2018 (UTC)
 * Johnuniq, if you want to improve the syntax, here is a working table

if I remove the  it doesn't work, but changing the   to   does work. makes sense to me because that's where the output units go. not an issue for me so long as something works. Frietjes (talk) 12:29, 31 October 2018 (UTC)
 * I've worked out what's going on. The problem is illustrated with:
 * → undefined undefined
 * → ft undefined
 * → undefined undefined
 * uses as the unit for
 * The second of the above converts is essentially  with   added. Because the unit used for a property cannot be predicted, convert provides what was considered a feature, namely it removes the output unit if it is the same as that used for the property. That means the convert is essentially   which uses the default output (m) giving the broken result shown above. Convert does that before the following inserts.
 * The reason that  gives the desired result is due to the way Lua performs  . If , the insert gives {'ft', nil, 'ft'}.
 * Then, executing  gives {'29029', 'ft', 'ft'}. That does what is wanted with.
 * I don't think convert needs to be changed but it is a quirk to bear in mind. Johnuniq (talk) 06:46, 1 November 2018 (UTC)

"Language" property vandalism
Someone vandalized the "language" property in the PH Wikidata template and added "Swardspeak" on it. For those who are not familiar, this is not a language of the Philippines. I can't access the template so there's no way to remove it. Raku Hachijo (talk) 08:53, 19 December 2018 (UTC)
 * @Raku Hachijo: What page shows the problem? Apparently Swardspeak is real although the term may be misused somewhere, but where? Johnuniq (talk) 09:36, 19 December 2018 (UTC)
 * Hmm, searching shows "Swardspeak" in the infobox, for example, at Marikina. That is due to the fact that the template shows information from Wikidata. Clicking "Wikidata item" in the tools box on the left of that article leads to where the history shows that Exec8 added Swardspeak in October. That seems a bit dubious to me but a discussion somewhere needs to establish what "Native languages" means and whether mentioning Swardspeak is WP:DUE. Johnuniq (talk) 09:49, 19 December 2018 (UTC)
 * Dasmariñas, Taguig and Parañaque too. It's almost on any city article other than Malabon, Manila or Cebu City has the word "Swardspeak" on it. — Preceding unsigned comment added by Raku Hachijo (talk • contribs) 10:37, 19 December 2018 (UTC)
 * Those articles have Swardspeak for the same reason mentioned above: in October Exec8 added Swardspeak to the "language used" property at Wikidata. You can edit Wikidata: click "Wikidata item" in the tools box on the left of the article, find the "language used" property where Swardspeak appears, click edit then remove. It would be better if there were some discussion at a suitable wikiproject first. Even if no one responds, a proposal to remove Swardspeak from multiple articles (with a brief reason) would give others an opportunity to offer an opinion. Johnuniq (talk) 00:12, 20 December 2018 (UTC)

Help troubleshooting missing URL/extra access-date in Alaminos, Pangasinan
Have no idea how this template works or how to go about fixing the result in Alaminos, Pangasinan with the error "Missing or empty |url= (help); |access-date= requires |url= (help)". — Chris Capoccia 💬 13:31, 14 September 2019 (UTC)
 * The problem is how template NCC detail is used in this template. On 23 July 2017, changed NCC detail to use the property ' instead of '. Unfortunately, this template was left still checking for '. So in Alaminos, Pangasinan, it tried to fetch a value that doesn't exist –  the Wikidata entry for  has no '. That produces the error that NCC detail generates when the url doesn't exist on Wikidata:
 * I've updated this template to look for , so it won't show a reference when the url is present in the related Wikidata entry. The infoboxes should be working as expected now. --RexxS (talk) 23:56, 14 September 2019 (UTC)
 * well it's still giving the same error. still no idea how a normal editor is supposed to understand what you're talking about above. — Chris Capoccia 💬 16:26, 12 October 2019 (UTC)
 * Well it's working now, because I just restored the fix I made on 14 September that was removed by yesterday. I suppose you didn't check Alaminos, Pangasinan in the intervening month when it was working properly? The explanation above was written to explain the problem to an editor who could understand the issue. In other words, I was hoping Exec8 would notice the fix and not remove it as they did yesterday. Next time the error shows up, all you have to do is restore Template:PH wikidata to the last working version. --RexxS (talk) 02:00, 13 October 2019 (UTC)
 * well it's still giving the same error. still no idea how a normal editor is supposed to understand what you're talking about above. — Chris Capoccia 💬 16:26, 12 October 2019 (UTC)
 * Well it's working now, because I just restored the fix I made on 14 September that was removed by yesterday. I suppose you didn't check Alaminos, Pangasinan in the intervening month when it was working properly? The explanation above was written to explain the problem to an editor who could understand the issue. In other words, I was hoping Exec8 would notice the fix and not remove it as they did yesterday. Next time the error shows up, all you have to do is restore Template:PH wikidata to the last working version. --RexxS (talk) 02:00, 13 October 2019 (UTC)

Empty footnote
Please see this VPT discussion. It looks like the template should test for Wikidata item content before displaying  tags. – Jonesey95 (talk) 00:08, 16 September 2020 (UTC)
 * I've added a test and its removed the empty reference at Sariaya and Manila. It should work, but I can't find an example where Wikidata has a value to make sure. —  Jts1882 &#124; talk 08:18, 16 September 2020 (UTC)

Date formats
Is there a way to change the date format from DMY to MDY? — hueman1 ( talk •  contributions ) 12:38, 28 October 2020 (UTC)
 * Date format is not defined in the Philippines. Some places (and wikipedia articles) are dmy and some are mdy. It is not up to you changed things to your ways. Not Samuel Pepys (talk) 08:18, 29 October 2020 (UTC)

DILG detail
I have corrected this template so that it now used the current values rather than 2013 ones. The template now doesn't use any parameter – it takes region / province / municipality/city direct from.

Incidentally, the use is wrong in most of the infoboxes - should not itself have surrounded with. Instead a reference can be added with in  when ready. Not Samuel Pepys (talk) 16:31, 29 October 2020 (UTC)

Changing of titles and contents
There are several sections for "user" use.

Demographics-1 and Demographics-2. Demographic is to do with people and their geography. And is not about economics. So we can write about Poverty incidence. We can include HDI. We can add other tables such as 'mortality table', 'age at death' etc. And more tables for poverty – quite a useful topic in Phils. Also 17 October, United Nations International Day for the Eradication of Poverty. I think the individual topic should be more to be similar. Demographics-2 could be used to do with language. -1 and -2 can each hold 10 items.

There two 'free' topics lists – each have room for 7 items. Here we could take one column of economic topics, and maybe the other to do with religion.

What we don't want to do is overload the topics. Cf. https://en.wikipedia.org/w/index.php?title=Cebu_City&oldid=983508994, where we have a title called Crime index with the contains Sister Cities!

Whatever, we need to do it as a project, not just one person do it. Not Samuel Pepys (talk) 19:04, 29 October 2020 (UTC)

revenue_point_in_time parameter apparently generates error
In the "Infobox settlement" of Naga, Camarines Sur, the call to causes


 * "http://www.cmcindex.org.ph/pages/profile/?lgu=Naga%20(CS) : Cities and Municipalities Competitiveness Index". Makati, Philippines: National Competitiveness Council (Philippines). Retrieved 6 April 2017. External link in |title= (help)

to appear in the References section. Note the "External link in |title= (help)", which appears in red. Dhtwiki (talk) 21:10, 23 September 2019 (UTC)


 * First think I see is that is be used as a QUAL, not as a main property.  So I changed to be QUAL of .  I don't why it's connected to Revenue, as it has not much to do with each other.  It should be read as a separate item.

"Provincial rankings are based on population and income weighted average of the Overall scores of cities and municipalities under a province."
 * Second problem is the url given is probably wrong. Instead try https://cmci.dti.gov.ph/pages/rankings/ – much more likely.  The problem is that the index is actually several different indexes – one for provinces, one for HUCs, one for CC, one 1st and 2nd class municipalities, one for 3rd to 6th class municipalities.


 * In fact years 2013 to 2018 inclusive, there is also a list of all municipalities together, but not for 2019.

Not Samuel Pepys (talk) 22:11, 29 October 2020 (UTC)
 * Using will be much easier to extract from Revenue (if that's where it should be attached).

I have corrected, but still testing. I have liaised with who corrected. But that doesn't help much with the coords etc. made out of. No matter what coordinate parameters put into, all in are ignored, and it just sends coordinate parameters of region:PH… and dim:city(pop) region: is supposed to be allowed for adm1st and adm2nd only dim: is best used with a circle – city(pop) is more likely wrong than right, so useless. See Central Visayas. Get a look!

type: should have fourth order – adm4th – added, for barangay. Not Samuel Pepys (talk) 09:32, 9 November 2020 (UTC)
 * Not Samuel Pepys, if you want to discuss changes to you should ask at Template talk:WikidataCoord.  if there is an article using this template and this template is generating the wrong type, let me know, but Central Visayas is not using this template for generating the coordinates.  Frietjes (talk) 15:20, 9 November 2020 (UTC)
 * – has been corrected ten days ago.  I can see that using  gets the correct sequence parameters.  But using  which passes into infobox, but the GeoHack parameters out of infobox do not have the right coordinate parameters.  I left the workings in  which  used, and before that .  OK, try another one – Tagbilaran, check what parameters are passed.    – region: is incomplete (because not allowed at third order); and type:city(106051) which is useless – dim:  is best.  Maybe OK (maybe!) when wikidata was young, but now it is mature, better choices should be used. Not Samuel Pepys (talk) 17:04, 9 November 2020 (UTC)
 * Central Visayas had wrong GeoHack –

until I corrected it 28 Oct, to -

– see how much better the map looks. Not Samuel Pepys (talk) 08:48, 10 November 2020 (UTC)

Something is not working properly
It seems like  and   are broken. — hueman1 ( talk •  contributions ) 15:33, 20 March 2021 (UTC)
 * Pinging. — hueman1 ( talk •  contributions ) 15:37, 20 March 2021 (UTC)
 * I'm not sure if all cities/municipalities are affected by this but I've seen a couple showing " of the Philippines ". — hueman1 ( talk •  contributions ) 15:40, 20 March 2021 (UTC)
 * hueman1, an example is needed (checking Passi, Iloilo looks fine). Frietjes (talk) 15:17, 22 March 2021 (UTC)
 * It's fine now. For what I have observed, made some changes on Wikidata that didn't match up with this template's code—this consequently affected the output of the template for quite some time. — hueman1 ( talk  •  contributions ) 15:40, 22 March 2021 (UTC)

Text-decoration should be inside PH_wikidata, not each infobox
I see that poverty_incidence,[a] poverty_incidence_point_in_time[b] and poverty_incidence_footnotes[c] are written as a% (B) C. However the text-decoration ["%" and parentheticals ""] should be supplied within PH_wikidata NOT by the infobox. There could be others.

We need add the text-decoration to the PH_wikidata - only once, but every infobox has to change to remove the text-decorations there. I'm sure there is an easy way of do it. I don't know what it is. Who can do it? Auntie Kathleen (talk) 02:21, 24 January 2023 (UTC)

Trouble with wikidata
This is not entirely with PH_wikidata but I don't know where to ask.

a within barangays, they haven't had the population for 2020. I have looked at a few (Cebu and Bohol) and none have 2020 (apart from a few I added). All current qualifiers P585 to be changed to be 'normal rank' and the new qualifier 2020 to be 'preferred rank'. I don't know about the rest but I guess the same. The data is easy to find, for instance: Census+of+Population+(2020).+"Region+VII+(Central+Visayas)".+Total+Population+by+Province%2C+City%2C+Municipality+and+Barangay

b in municipalities and cities, property P8843 poverty_incidence, with qualifier of P585 point_in_time should contain reference: P123 publisher, P577 publication_date, P854 reference_URL, P1476 title. The set of references is the same for each P8843, except for 2012 P854 has to corrected from a literal. The reference should remove any P813.

Auntie Kathleen (talk) 03:11, 24 January 2023 (UTC)

User:Migfab008
This user has decided to change ever page containing Philippine connection. S/he is changing any dmy to become mdy, and adding to

Change everything back, and ANI the user - s/he had been warned about vandalism last week Auntie Kathleen (talk) 06:13, 24 January 2023 (UTC)

Bad parameters or code
Naga, Cebu has a stripped in the infobox that traces to , so I wondered what else is messed up.

I don't know the syntax of infobox lighthouse and its bulleted items, so I didn't test those.

The only parameter generating a lint error is poverty_incidence.

The only parameter generating unsupported input error is number of divisions.

Will someone please fix these parameters or code, and also the Usage section should better explain how to use infobox lighthouse and its bulleted items. —Anomalocaris (talk) 03:38, 28 March 2023 (UTC)
 * This Linter problem appears to have been fixed. The stripped tag still shows up in LintHint in Preview, but that looks like a limitation of LintHint. – Jonesey95 (talk) 14:02, 17 September 2023 (UTC)

Confusing map caption
I noted in the map caption reading Map of Romblon with Romblon highlighted in the Romblon, Romblon article. I understand that this comes about as a consequence the unfortunate re-use of Romblon as both the name of the province and the name of the island, but still ...

It seems to me that this can be corrected by editing in this template


 *  | map_caption = 

to read
 *  | map_caption = 

However, fearing side-effects, I'm reluctant to make a WP:BOLD edit to that effect, so I'll just mention that as a suggestion here. It would probably flout scoping intentions, but perhaps it would be a better solution for that article to use a specific locally selected image and a literal locally defined caption. Comments? Wtmitchell (talk) (earlier Boracay Bill) 14:14, 18 July 2023 (UTC)