Skip to content

Instantly share code, notes, and snippets.

class OnsReader
require 'httpclient'
BaseUrl = "http://neighbourhood.statistics.gov.uk/dissemination/"
def self.process
sets = YAML.load_file(File.join(RAILS_ROOT, "db/ons_data", "current_datasets.yml"))[0..100]
client = HTTPClient.new
sets.each do |set|
url = set[:url]
class OnsDatasetFinder
require 'httpclient'
BaseUrl = "http://neighbourhood.statistics.gov.uk/dissemination/"
def self.process
all_datasets = []
home_page = "http://neighbourhood.statistics.gov.uk/dissemination/Download1.do"
parsed_page = get_page(home_page)
dataset_group_paths = parsed_page.search('#mainContent3 li a[@href*="datasetList.do"]').collect {|ds| ds[:href]}.uniq
<?xml version="1.0" encoding="utf-16"?>
<ArrayOfFullNotice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<FullNotice>
<Id>bd65102e-ee39-45c1-a941-a30fd3c7709c</Id>
<Notice>
<Id>bd65102e-ee39-45c1-a941-a30fd3c7709c</Id>
<ConfidenceLevel>100</ConfidenceLevel>
<ContactDetails>
<Email>minorworkssouth@noms.gsi.gov.uk</Email>
<Address1>Phoenix House</Address1>