Difference between revisions of "OpenAid"

From WPUK wiki
Jump to: navigation, search
(Components of the solution)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Idea 5 for WordHack 2010 was an Open Aid Projects site, built in WordPress, that imported data from DFID's
+
Idea 5 for WordHack 2010 was an Open Aid Projects site, built in WordPress, that imported data from an XML file released by the Department for International Development.
  
 
== Original idea: IDEA 5: Commentable WordPress site based on Government data ==
 
== Original idea: IDEA 5: Commentable WordPress site based on Government data ==
Line 12: Line 12:
 
# Write a plugin to parse the XML and to create a Post for each <nowiki><project></nowiki> node in the XML file, and populate the correct custom metadata. Also populate tags and categories based on project attributes (e.g. country, region, aid sector).
 
# Write a plugin to parse the XML and to create a Post for each <nowiki><project></nowiki> node in the XML file, and populate the correct custom metadata. Also populate tags and categories based on project attributes (e.g. country, region, aid sector).
 
# Have an "update content" button that can add new nodes when the XML file is updated.
 
# Have an "update content" button that can add new nodes when the XML file is updated.
 
'''Initial research'''
 
This [http://wordpress.org/support/topic/318571 WordPress Support thread] contains a very rough example of a plugin to import XML and create a post with post attributes. May give us some ideas, although not configured for a Custom Post Type.
 
 
The [http://wordpress.org/extend/plugins/feedwordpress/ FeedWordPress plugin] may also provide some ideas, although I notice that it's broken in 3.0.
 
  
 
''Personal note:'' this WordHack would join both my day job in DFID with my interest in WordPress - this is a very topical issue and could have other applications across government datasets.
 
''Personal note:'' this WordHack would join both my day job in DFID with my interest in WordPress - this is a very topical issue and could have other applications across government datasets.
  
 
Originator: John Adams ([http://twitter.com/johnthegeo @johnthegeo])
 
Originator: John Adams ([http://twitter.com/johnthegeo @johnthegeo])
Team members: Shaun Hare (@wordhackuk),
 
  
 +
== Initial research ==
 +
 +
This [http://wordpress.org/support/topic/318571 WordPress Support thread] contains a very rough example of a plugin to import XML and create a post with post attributes. May give us some ideas, although not configured for a Custom Post Type.
 +
 +
The [http://wordpress.org/extend/plugins/feedwordpress/ FeedWordPress plugin] may also provide some ideas, although I notice that it's broken in 3.0.
  
 
== Components of the solution ==
 
== Components of the solution ==
  
'''1. XML Transform'''
+
=== 1. XML Transform ===
Pulling XML from DFID source data, transforming to the target XML structure. Adds meaningful content for both country and sector information, based on lookup xml files.
+
Pulling XML from DFID source data, transforming to the target XML structure. Also adds meaningful content for both country and sector information, based on lookup xml files.
  
 
Exported XML
 
Exported XML
Line 33: Line 32:
 
<project code='' uri=''>
 
<project code='' uri=''>
 
     <title />
 
     <title />
     <country />
+
     <country code='' />
 
     <description />
 
     <description />
 
     <sectors>
 
     <sectors>
         <sector group='' name='' />
+
         <sector code='' group='' name='' percentage='' />
 
     </sectors>
 
     </sectors>
     <budget />
+
     <totalBudget />
     <expenditure />
+
     <expenditureToDate />
 
</project>
 
</project>
 
</pre>
 
</pre>
  
Credit: @wordhackuk, @paulbunkham
+
Credit: [http://twitter.com/paulbunkham Paul Bunkham], [http://twitter.com/wordhackuk Shaun Hare]
  
'''2. Import XML into WordPress'''
+
=== 2. Import XML into WordPress ===
 
Simple rules...in pseudocode
 
Simple rules...in pseudocode
  
<nowiki>
+
<pre>
 
if the project already exists (project code exists)
 
if the project already exists (project code exists)
 
     if content has changed
 
     if content has changed
Line 54: Line 53:
 
else
 
else
 
     create a new project
 
     create a new project
</nowiki>
+
</pre>
  
Credit: @cnorthwood
+
Credit: [http://twitter.com/cnorthwood Chris Northwood]
  
'''3. Custom Post Type'''
+
==== To Do ====
The custom post type will contain
+
  
* Project (component) code
+
* Code which checks for duplication currently does not work
* Project (component) title
+
* No code is currently written to create a new post revision if the post does already exist
* Project purpose (description)
+
* The import needs to be created as a scheduled cron job
* Country
+
* Input Sector(s)
+
* Financial
+
** Total approved budget
+
** Actual expenditure to date
+
  
Credit: @iamfriendly
+
=== 3. Custom Post Type ===
 +
The custom post type contains
  
'''4. Theme'''
+
*Project (component) code
Theme to improve UX, to include mobile theme for use by citizens of developing countries.
+
*Project (component) title
 +
*Project purpose (description)
 +
*Country
 +
*Input Sector(s)
 +
*Financial
 +
**Total approved budget
 +
**Actual expenditure to date
  
Credit: @madhavaji
+
Credit: [http://twitter.com/iamfriendly Richard Tape]
  
'''5. Comments related to revisions'''
+
=== 4. Theme ===
 +
Theme to provide a clean user experience, to include mobile theme for use by citizens of developing countries.
  
== Developers ==
+
Front page shows most recent comments with link to the project being discussed. Keeps dynamic. Also shows lists of countries and categories (for aid geeks = "sectors").
  
@madhavaji
+
Credit: [http://twitter.com/madhavaji Michael Bailey]
  
@iamfriendly
+
=== 5. Comments related to revisions ===
 +
Every time the XML file updates the data for a project, the project post will be versioned. This plugin links comments to specific post revisions.
  
@cnorthwood
+
Credit: [http://twitter.com/kieranoshea Kieran O'Shea]
  
@kieranoshea
 
  
@paulbunkham
+
== WordPress Site ==
 +
Base WordPress install
  
@wordhackuk
+
=== Theme ===
 +
'''OpenAid''' theme based on Clean Home containing:
 +
*New index.html which shows recent comments
 +
*New widget area 'Blurb' - a Text widget in this area displays the texty blurb in the header
 +
*Template for the front page
  
@johnthegeo
+
=== Plugins ===
 +
*DFID Data Import plugin (bespoke by Chris)
 +
*[http://wordpress.org/extend/plugins/get-recent-comments/ Get Recent Comments] plugin, with some HTML display modifications
 +
*Versioning plugin (bespoke by Kieran)
 +
 
 +
== Live Site ==
 +
The current solution can be seen at [http://www.openaid.org.uk/ openaid.org.uk].
 +
 
 +
Demo site is at [http://demo.openaid.org.uk/ demo.openaid.org.uk]
 +
 
 +
You can also follow the project on Twitter - [http://twitter.com/openaiduk @openaiduk].
 +
 
 +
== Code ==
 +
 
 +
Google Code repository...
 +
http://code.google.com/p/openaiduk/
 +
 
 +
 
 +
== Developers ==
 +
 
 +
* [http://twitter.com/madhavaji Michael Bailey]
 +
* [http://twitter.com/iamfriendly Richard Tape]
 +
* [http://twitter.com/cnorthwood Chris Northwood]
 +
* [http://twitter.com/kieranoshea Kieran O'Shea]
 +
* [http://twitter.com/paulbunkham Paul Bunkham]
 +
* [http://twitter.com/wordhackuk Shaun Hare]
 +
* [http://twitter.com/johnthegeo John Adams]
  
 
== Possible future extensions ==
 
== Possible future extensions ==
  
 
BuddyPress to create a commenting community, with alerts and a registration of interest
 
BuddyPress to create a commenting community, with alerts and a registration of interest
 
Comment versions metadata
 

Latest revision as of 23:52, 19 July 2010

Idea 5 for WordHack 2010 was an Open Aid Projects site, built in WordPress, that imported data from an XML file released by the Department for International Development.

Original idea: IDEA 5: Commentable WordPress site based on Government data

Transparency is one of the high priorities of the new UK government and the Prime Minister has promised that government will publish a wide range of datasets by the end of 2010. The Department for International Development (disclosure: where I work) has promised to release reusable data on UK aid projects by January 2011.

This WordHack would attempt to create a commentable WordPress site based on XML data from DFID (this is not the final data format, but would be good enough for a WordHack protoype). The aim of the site would be to allow the public in both the UK and developing countries to comment on specific DFID projects.

I'd like to:

  1. Create a new Custom Post Type for a DFID Project, to capture the key project attributes released in the XML file.
  2. Write a plugin to parse the XML and to create a Post for each <project> node in the XML file, and populate the correct custom metadata. Also populate tags and categories based on project attributes (e.g. country, region, aid sector).
  3. Have an "update content" button that can add new nodes when the XML file is updated.

Personal note: this WordHack would join both my day job in DFID with my interest in WordPress - this is a very topical issue and could have other applications across government datasets.

Originator: John Adams (@johnthegeo)

Initial research

This WordPress Support thread contains a very rough example of a plugin to import XML and create a post with post attributes. May give us some ideas, although not configured for a Custom Post Type.

The FeedWordPress plugin may also provide some ideas, although I notice that it's broken in 3.0.

Components of the solution

1. XML Transform

Pulling XML from DFID source data, transforming to the target XML structure. Also adds meaningful content for both country and sector information, based on lookup xml files.

Exported XML

<project code='' uri=''>
    <title />
    <country code='' />
    <description />
    <sectors>
        <sector code='' group='' name='' percentage='' />
    </sectors>
    <totalBudget />
    <expenditureToDate />
</project>

Credit: Paul Bunkham, Shaun Hare

2. Import XML into WordPress

Simple rules...in pseudocode

if the project already exists (project code exists)
    if content has changed
         update content, create new post revision
else
    create a new project

Credit: Chris Northwood

To Do

  • Code which checks for duplication currently does not work
  • No code is currently written to create a new post revision if the post does already exist
  • The import needs to be created as a scheduled cron job

3. Custom Post Type

The custom post type contains

  • Project (component) code
  • Project (component) title
  • Project purpose (description)
  • Country
  • Input Sector(s)
  • Financial
    • Total approved budget
    • Actual expenditure to date

Credit: Richard Tape

4. Theme

Theme to provide a clean user experience, to include mobile theme for use by citizens of developing countries.

Front page shows most recent comments with link to the project being discussed. Keeps dynamic. Also shows lists of countries and categories (for aid geeks = "sectors").

Credit: Michael Bailey

5. Comments related to revisions

Every time the XML file updates the data for a project, the project post will be versioned. This plugin links comments to specific post revisions.

Credit: Kieran O'Shea


WordPress Site

Base WordPress install

Theme

OpenAid theme based on Clean Home containing:

  • New index.html which shows recent comments
  • New widget area 'Blurb' - a Text widget in this area displays the texty blurb in the header
  • Template for the front page

Plugins

  • DFID Data Import plugin (bespoke by Chris)
  • Get Recent Comments plugin, with some HTML display modifications
  • Versioning plugin (bespoke by Kieran)

Live Site

The current solution can be seen at openaid.org.uk.

Demo site is at demo.openaid.org.uk

You can also follow the project on Twitter - @openaiduk.

Code

Google Code repository... http://code.google.com/p/openaiduk/


Developers

Possible future extensions

BuddyPress to create a commenting community, with alerts and a registration of interest

Retrieved from "?title=OpenAid&oldid=2144"