def short_date(s) return if s.nil? Date.parse(s).strftime("%e %b %Y") end def cleanup(s) return if s.nil? s.sub!('Unknown', '') s.sub!('Not Available', '') s.sub!('Not Applicable', '') s = "#{s}" if s.match(/(approve|grant|permitted)/i) s = "#{s}" if s.match(/refus/i) s end def slug(s) s.downcase.gsub(' ', '-') end def authority_url(authority_name) "/authorities/#{slug(authority_name)}/" end def download_button(filename, label='Download CSV data') "#{label}" end def normalise_decision(d) # https://schemas.opendata.esd.org.uk/PlanningApplications/LocalOpenDataIncentiveSchemePlanningApplicationsSchemaGuidance.pdf end