Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The data from the Modern.gov RSS feed needs to be reformatted before it can be used by iShare. This is done via a Stored Procedure Task. In the tree, right click on the Update Modern.gov Data Job you have just created and select New Task.

...

Task Details

Enter the following:

Task Name

Enter a Name for the task e.g. Format Modern.gov MPs

Connection

Select the Data Share database from the list.

Stored Procedure

First select the Workflow radio button as this will limit the list of available stored procedures and then select the at_wkf_executecmd entry from the list.

Parameters

Click on Parameter 1. cmdtoexecute and enter the following:

...

Code Block
languagesql
titleExample
drop table if exists moderngov_mps_spatial;
   
Create table moderngov_mps_spatial as
select d.ogc_fid,d.wkb_geometry,d.name, mg.* from boundaryline_westminster_constituenciesconst_region as d, 
(select constit, '<div class="modern-dot-gov-councillor">
  <h5 class="name">
    <a href="' || "userpage" || '" alt="View Member of Parliament' || "name" || ' web page">' || "name" || '</a>
  </h5>
  <ul>
    <li class="modern-dot-gov-councillor-portrait">
      <a href="' || "userpage" || '" alt="View Member of Parliament ' || "name" || ' web page"><img src="' || "photo" || '"></a>
    </li>
    <li>' || "party" || '</li>
  </ul>
</div>' as full_html
     from (select title as name,
     replace(replace(substr(description, strpos(description,'for ')+4,100),'&','and'), '-',' ') as constit,
substr(description, 0,strpos(description,', ')) as party,
substr(link, strpos(link,'id=')+3,3) as userid,
substr(link, 0, strpos(link,'mgMember')) || 'mgUserInfo.aspx?UID=' || substr(link, strpos(link,'id=')+3,3) as userpage,
substr(link, 0, strpos(link,'mgMember')) as cmissite,
substr(link, 0, strpos(link,'mgMember')) || 'UserData/' || SUBSTRING(lpad(substr(link, strpos(link,'id=')+3,3), 4, '0'),4,1) || '/'
|| SUBSTRING(lpad(substr(link, strpos(link,'id=')+3,3), 4, '0'),3,1) || '/'
|| SUBSTRING(lpad(substr(link, strpos(link,'id=')+3,3), 4, '0'),2,1) || '/Info'
|| lpad(substr(link, strpos(link,'id=')+3,3), 8, '0') || '/bigpic.jpg' as photo
from "Moderngov_mps") as mg) as mg
WHERE lower(replace(substr(d.name,0,strpos(replace(d.name,'Boro ','Co '),' Co Const')), '.','')) = lower(constit)
order by name;

...