User talk:Dr pda/persondata.js

From Wikipedia, the free encyclopedia

This script is designed to simplify the addition of persondata to biographical articles.

Contents

[edit] What is Persondata?

Persondata is special metadata which can be added to biographical articles. This metadata can then be extracted and processed automatically. On the German Wikipedia 95% of biographies (approx 120 000 articles) are tagged with persondata. One example of its use is this page which allows you to find all people who were born/died on a given date (and have articles in the de wiki).

The persondata template has the fields

<!-- Metadata: see [[Wikipedia:Persondata]] -->
{{Persondata
|NAME=
|ALTERNATIVE NAMES=
|SHORT DESCRIPTION=
|DATE OF BIRTH=
|PLACE OF BIRTH=
|DATE OF DEATH=
|PLACE OF DEATH=
}}

[edit] How the script works

All the persondata information (if known) should already be contained in the article. While it is trivial for a person to scan the article and extract this information, it is difficult to do automatically, as the information is generally not in a standardised format. However many biographies already contain an infobox, the fields of which are easily parsed, and contain most or all of the information required by the persondata template. The script therefore extracts as much information as it can, inserts the persondata template into the article, and shows the diff, so you can see what was added, and (if it is OK) save it. The script has been tested with the 20 or so most common infoboxes. These are (as of February 2007):

  1. {{Infobox Football biography}} 9938
  2. {{Infobox musical artist}} 9281
  3. {{Infobox NFL player}} 4203
  4. {{Infobox actor}} 3821
  5. {{Infobox Biography}} 2814
  6. {{Infobox Military Person}} 2080
  7. {{Infobox musical artist 2}} 2072
  8. {{Infobox Officeholder}} 2031
  9. {{Infobox Ice Hockey Player}} 1681
  10. {{Infobox celebrity}} 1428
  11. {{Infobox MLB player}} 1174
  12. {{Infobox Wrestler}} 1155
  13. {{Infobox President}} 1028
  14. {{Infobox writer}} 991
  15. {{Infobox afl player}} 870
  16. {{Infobox Politician}} 804
  17. {{Infobox Congressman}} 722
  18. {{Infobox NBA player}} 657
  19. {{Infobox Prime Minister}} 648
  20. {{Infobox Scientist}} 645

This is a total of approx 50000 articles. There are currently only 5000–6000 articles with persondata.

Other infoboxes will probably also work if they use similar names for the parameters.

[edit] How to use the script

To get the script working add {{subst:js|User:Dr pda/persondata.js}} (or your favourite method of importing a script) to your monobook.js, then do a forced reload to bypass the cache (ctrl+shift+R in Firefox, ctrl+F5 in Internet Explorer, F5 in Opera, etc).

In normal mode if an article already has persondata you will see a tab show/hide persondata. Clicking on this toggles the display of persondata, located at the bottom of the article. This tab also serves to indicate at a glance whether an article has persondata.

In edit mode if an article doesn't have persondata, a tab add persondata will appear. (NB this will happen even for non-biographical articles!). If you click on this tab the script will extract as much data as it can from the first infobox it finds. (If there is no infobox the script will not do anything), and then automatically click the Show changes button, so you can see the results. Check the persondata template, make any necessary changes, and then save the article.

[edit] Advice

  • ALWAYS CHECK THE OUTPUT BEFORE SAVING
  • In particular check the NAME and ALTERNATIVE NAMES fields; sometimes middle names are omitted, unnecessary honorifics are included, the name and alternative name should be swapped, etc.
  • Not all infoboxes contain all the fields for persondata, you may need to add some manually.
  • Check the persondata page for further information on how to fill in the fields (note that name should be lastname, firstname).
  • Moreover, take care when using it on people without last names, like Peter II of Russia. He should not be listed as "II, Peter", but instead "Peter II, Emperor of Russia". See Wikipedia:Persondata#Data_fields for further clarification.

[edit] Conflict with WikEd

Just a minor problem, I have to disable WikEd before this script will work, but then it does what it says it does with no problem. – ukexpat (talk) 21:42, 7 April 2008 (UTC)

[edit] Bug/Glitch

I just tried to use the script on Unity Mitford and the output was a mess. I am sure it is caused by some of the formatting/text of the article, so just reporting it as an FYI. – ukexpat (talk) 13:50, 29 May 2008 (UTC)