FOIwiki:ScraperSync: Difference between revisions

From FOIwiki
Jump to navigationJump to search
(→‎List requirements: end comment)
Line 11: Line 11:
<pre><nowiki><!-- ScraperSync start { "scraper": "thing" } --></nowiki></pre>
<pre><nowiki><!-- ScraperSync start { "scraper": "thing" } --></nowiki></pre>


After the word "start" is a JSON object which configures ScraperSync.  It contains a single entry, "scraper", which names the scraper from which the data should be pulled.
After the word "start" is a JSON object which configures ScraperSync.  It can contain the following entries:
 
* <tt>scraper</tt>: names the scraper from which the data should be pulled.
* <tt>sort</tt>: if set to <tt>name</tt>, sorts list entries by name.


ScraperSync understands several different list formats, and tries to remove markup and notes to work out what public authority is named by the item.
ScraperSync understands several different list formats, and tries to remove markup and notes to work out what public authority is named by the item.

Revision as of 16:09, 9 April 2012

ScraperSync is a tool for maintaining an FOIwiki page as a mirror of a dataset from ScraperWiki. It attempts to preserve markup and changes in the page while propagating changes from the dataset.

Dataset requirements

The dataset must have a table called "swdata" containing a column called "name". The contents of this column form the texts of entries in a bulletted list in the wiki page.

List requirements

The start of the maintained list is marked by a special comment like this:

<!-- ScraperSync start { "scraper": "thing" } -->

After the word "start" is a JSON object which configures ScraperSync. It can contain the following entries:

  • scraper: names the scraper from which the data should be pulled.
  • sort: if set to name, sorts list entries by name.

ScraperSync understands several different list formats, and tries to remove markup and notes to work out what public authority is named by the item.

The maintained list is ended by another special comment:

<!-- ScraperSync end -->

Output

ScraperSync's main output is a new version of the page source. This should be the same as the current page, but with any list entries that don't appear in the ScraperWiki dataset struck out. It also appends to this a list of those items that appeared in the source dataset but not in the wiki page. ScraperSync tries to automatically make this into links to WhatDoTheyKnow.

Creating a new page

ScraperSync has a mode for creating an entirely new page from a dataset. This can be most easily activated by running it with no options and choosing "Create new" and entering the URL name of the Scraper to use as the source.