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 Councillors

Connection

Select the Data Share database from the list.

Stored Procedure

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

Parameters

Click on Parameter 1. tablename and enter moderngov_spatial in the Edit parameter 'tablename' box e.g.

Image RemovedImage Added

Now click on Parameter 2. selectstatement and enter the following select statement in the Edit parameter 'selectstatement' box.

...

Code Block
languagesql
titleExample
select 
  ogc_fid, wkb_geometry, name,
  CASE WHEN ward is null THEN
    replace(name, ' ED','')
  ELSE
    ward
  END,
  CASE WHEN full_html is null THEN
    '<div class="modern-dot-gov-councillor">
  <h5 class="name">
    No elected councillor at present.
  </h5>
  </div>'
  ELSE
    full_html
  END  
 from (select d.ogc_fid,d.wkb_geometry,d.name, replace(lower(substr(d.name,0,strpos(d.name,' ED'))), '.',''),mg.* from 
boundaryline.county_electoral_division as d LEFT JOIN 
(select ward, '<div class="modern-dot-gov-councillor">
  <h5 class="name">
    <a href="' || "userpage" || '" alt="View Councillor ' || "name" || ' web page">' || "name" || '</a>
  </h5>
  <ul>
    <li class="modern-dot-gov-councillor-portrait">
      <a href="' || "userpage" || '" alt="View Councillor ' || "name" || ' web page"><img src="' || "photo" || '"></a>
    </li>
    <li>' || "party" || '</li>
    <li>
      <a href="' || "cmissite" || '" alt="More information on Councillors and Committees">More information on Councillors and Committees</a>
    </li>
  </ul>
</div>' as full_html
     from (select title as name,
    replace(replace(substr(description, strpos(description,'Ward: ')+6,100),'&','and'), '-',' ') as ward, 
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(lower(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(lower(link),'id=')+3,3), 4, '0'),4,1) || '/'
|| SUBSTRING(lpad(substr(link, strpos(lower(link),'id=')+3,3), 4, '0'),3,1) || '/'
|| SUBSTRING(lpad(substr(link, strpos(lower(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_councillors) as mg) as mg
ON lower(replace(substr(d.name,0,strpos(d.name,' ED')), '.','')) = lower(ward)
order by name)
as results

 

E.g.

Image RemovedImage Added

Now click the Run button  to run the Task to create the moderngov_spatial table.

...