GSoC 2017: Week VIII & IX

I will describe my progress in the last two weeks in this post. For a change let me begin with something else. This year’s Wimbledon is ongoing. I myself play Tennis once in a while. So I thought why not share some of the Tennis musings with you today. This Sunday Federer will meet Marin Cilic in the Men’s final. So far in the tournament Federer seems unbeatable. Given his class and his records in the grass court Federer is undoubtedly the favorite. But Cilic is also at the top of his game. So it will be interesting to see the fight that Cilic puts up. Hoping to witness a 5-set high voltage match.

Now let’s come back to the reports.

The Infobox Templates:

So, given an image from a GLAM we can categorize it into several groups such as Photograph, Artwork, Art Photo etc.  As of now we are only focusing on the types Photograph and Art Photo. How do you know which is the most suitable type from the given image? Well, either the GLAM will specify it or the end user will have to provide that data.

Our OOP Approach:

Given the URL or GLAM name plus unique ID combination we do the following things in order.

  1. Veryfy if the given input is valid.
  2. If validated then we extract the json from the URL.
  3. From the json we decide on which Infobox template to use.
  4. Also from the json we extract the relevant fields and do the mapping into our infobox template decided in the previous step.
  5. Invoke pywikibot to upload the image to Wikimedia Commons.

To implement the above we will have one base class GenericGLAM.

Any number of GLAMs can be added as part of our tool for uploading images to commons using the following steps.

  • Make a class for the new GLAM that inherits from GenericGLAM.
  • In the new GLAM class the constructor of the base class GenericGLAM will be invoked with the given url or the url formed from the GLAM name plus unique ID combination.
  • So every new upload will essentially create an instance of the GenericGLAM class.
  • Inside the new GLAM derived class there will be methods to choose the correct infobox type for the given image. Also the metadata mapping specific to the GLAM will take place here.
  • The base class will receive the metadata mapping from the derived GLAM class and form the wikitext.

Subsequently the pywikibot upload module may be called to perform the upload to Wikimedia Commons.

The relevant code is available here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s