SlideShare a Scribd company logo
1 of 25
@sfusgs Geo-tweet my quake… @ayman • yahoo! research http://en.wikipedia.org/wiki/File:San_francisco_1906_earthquake.jpg
Zync • Y! Messenger
FireEagle
FireEagle @ayman
http://bit.ly/statler
shake and rumble in 2GA
http://earthquake.usgs.gov/earthquakes/recenteqsus/Quakes/nc71336726.php
Click through maps…
A Want Ad
USGS lists every quake
http://earthquake.usgs.gov/earthquakes/catalogs/
http://earthquake.usgs.gov/earthquakes/catalogs/
Trust me, it is just XML
Yahoo! Search goes to YDN
Google Search goes to YDN
Bing goes to YDN
Using ElementTree
The flow was simple CRON this:: cUrl XML feed from USGS find local quakes bit.ly the quake permalink if not duplicate record this quake tweet this quake
def fetch_quakes(): def fetch_quakes(): api = bitly.Api(login=’ABCDEF', apikey=’12345678901234567890') rss = parse(urllib.urlopen(USGS_URL)).getroot()     quakes = []     for element in rss.findall('{%s}entry' % USGS_NS):         title = element.findtext('{%s}title' % USGS_NS)        if (title.find("San Francisco Bay") > -1):             point = element.findtext('{%s}point' % GEORSS_NS)             points = point.split(None, 1)             link = element.find('{%s}link' % USGS_NS) href = 'http://earthquakes.usgs.gov%s' % link.get('href') href = api.shorten(href)           if (is_duplicate(href) is False): f = open(‘urls.txt', 'a') f.write('%s' % href) f.close()                 summary = element.findtext('{%s}summary' % USGS_NS)                 summary = summary.split("<br>")[1]                 summary = summary.replace(' at epicenter</p><p>', ' ')                 summary = strip_tags(summary) quakes.append({'title': element.findtext('{%s}title' % USGS_NS),                                'link' : href,                                'updated' : element.findtext('{%s}updated' % USGS_NS),                                'long' : points[1],                                'lat' : points[0],                                'elev' : element.findtext('{%s}elev' % GEORSS_NS),                                'summary' : summary})     return quakes
def is_duplicate(url): def is_duplicate(url):     from subprocess import call if(os.path.exists(‘urls.txt') is False):         call(['/usr/bin/touch', ‘urls.txt']) r = call(['/bin/fgrep', url,               ‘urls.txt'])     if (r == 0):         return True     else:         return False
def send_tweet(t): def send_tweet(t):     import httplib2     username = ’ABCDEFG'     password = ’12345678901234567890' msg = ('%s %s %s' % (t['title'], t['link'], t['summary']))     http = httplib2.Http() http.add_credentials(username, password)     response = http.request(         "http://twitter.com/statuses/update.xml",         "POST", urllib.urlencode({"status": msg,                            "lat": t['lat'],                            "long": t['long']})     ) SEE: http://code.google.com/p/httplib2/ ps: you shouldn’t store your passwords like that…this is just an illustration
fin
Crunched
USGS on Open Gov’t
Open Questions? How can other local sources be disseminated? How can mass media be filtered so it can be consumed in a similar manner? Can we collect information around the news? For example, find all the tweets that relate to a particular quake. Thanks, @ayman.

More Related Content

What's hot

20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked aboutTatsuhiko Miyagawa
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin
 
Perlのsmart match演算子
Perlのsmart match演算子Perlのsmart match演算子
Perlのsmart match演算子ast_j
 
Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)Jacqueline Durett
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of SmartmatchAndrew Shitov
 
Simulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with FluctuationSimulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with FluctuationMax Braun
 
LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1umapst
 
pt-query-digest は Perl!!
pt-query-digest は Perl!!pt-query-digest は Perl!!
pt-query-digest は Perl!!Takafumi ONAKA
 
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав ВорончукFrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав ВорончукGeeksLab Odessa
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門Yusuke Wada
 

What's hot (12)

20 modules i haven't yet talked about
20 modules i haven't yet talked about20 modules i haven't yet talked about
20 modules i haven't yet talked about
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"
 
Perlのsmart match演算子
Perlのsmart match演算子Perlのsmart match演算子
Perlのsmart match演算子
 
Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)Robert Murdock Band Brings 60s back to S.A. (The Suburban)
Robert Murdock Band Brings 60s back to S.A. (The Suburban)
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
Perl6 in-production
Perl6 in-productionPerl6 in-production
Perl6 in-production
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of Smartmatch
 
Simulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with FluctuationSimulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
Simulating Artificial Muscles for Controlling a Robotic Arm with Fluctuation
 
LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1LAMP_TRAINING_SESSION_1
LAMP_TRAINING_SESSION_1
 
pt-query-digest は Perl!!
pt-query-digest は Perl!!pt-query-digest は Perl!!
pt-query-digest は Perl!!
 
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав ВорончукFrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
FrontendLab: Programming UI with FRP and Bacon js - Вячеслав Ворончук
 
PerlでWeb API入門
PerlでWeb API入門PerlでWeb API入門
PerlでWeb API入門
 

Similar to SFUSGS

Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With PhpJeremy Coates
 
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Lance Roggendorff
 
Place not Space; Geo without Maps
Place not Space; Geo without MapsPlace not Space; Geo without Maps
Place not Space; Geo without MapsGary Gale
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Robin Fernandes
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Atlassian
 
rules, events and workflow
rules, events and workflowrules, events and workflow
rules, events and workflowMark Proctor
 
jQuery Performance Rules
jQuery Performance RulesjQuery Performance Rules
jQuery Performance Rulesnagarajhubli
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricksambiescent
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsandrewnacin
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertextfrankieroberto
 
Zoo management adri jovin
Zoo management  adri jovinZoo management  adri jovin
Zoo management adri jovinAdri Jovin
 
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011John Ford
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめようYuriko IKEDA
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptJustin Deoliveira
 

Similar to SFUSGS (20)

JQuery Basics
JQuery BasicsJQuery Basics
JQuery Basics
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data Exploring the Sweet Spot: Geolocation, Health, and Gov-data
Exploring the Sweet Spot: Geolocation, Health, and Gov-data
 
Ae internals
Ae internalsAe internals
Ae internals
 
Prototype js
Prototype jsPrototype js
Prototype js
 
Place not Space; Geo without Maps
Place not Space; Geo without MapsPlace not Space; Geo without Maps
Place not Space; Geo without Maps
 
Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605Summit2011 satellites-robinf-20110605
Summit2011 satellites-robinf-20110605
 
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
rules, events and workflow
rules, events and workflowrules, events and workflow
rules, events and workflow
 
jQuery Performance Rules
jQuery Performance RulesjQuery Performance Rules
jQuery Performance Rules
 
Cheap frontend tricks
Cheap frontend tricksCheap frontend tricks
Cheap frontend tricks
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIs
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
Zoo management adri jovin
Zoo management  adri jovinZoo management  adri jovin
Zoo management adri jovin
 
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめよう
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScript
 

More from David Shamma

Recommending Actions, Not Content
Recommending Actions, Not ContentRecommending Actions, Not Content
Recommending Actions, Not ContentDavid Shamma
 
Staying together: Understanding People and Media in Synchronous Connected Sy...
Staying together:  Understanding People and Media in Synchronous Connected Sy...Staying together:  Understanding People and Media in Synchronous Connected Sy...
Staying together: Understanding People and Media in Synchronous Connected Sy...David Shamma
 
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...David Shamma
 
A Movie And A Chat
A Movie And A ChatA Movie And A Chat
A Movie And A ChatDavid Shamma
 
Synergies Between Search and Social Metrics
Synergies Between Search and Social MetricsSynergies Between Search and Social Metrics
Synergies Between Search and Social MetricsDavid Shamma
 
Video Creativity beyond Dissemination
Video Creativity beyond DisseminationVideo Creativity beyond Dissemination
Video Creativity beyond DisseminationDavid Shamma
 
Watch What I Watch
Watch  What  I  WatchWatch  What  I  Watch
Watch What I WatchDavid Shamma
 

More from David Shamma (9)

Recommending Actions, Not Content
Recommending Actions, Not ContentRecommending Actions, Not Content
Recommending Actions, Not Content
 
Staying together: Understanding People and Media in Synchronous Connected Sy...
Staying together:  Understanding People and Media in Synchronous Connected Sy...Staying together:  Understanding People and Media in Synchronous Connected Sy...
Staying together: Understanding People and Media in Synchronous Connected Sy...
 
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
Human to Dancer Interaction: Designing for Embodied Performances in a Partici...
 
A Movie And A Chat
A Movie And A ChatA Movie And A Chat
A Movie And A Chat
 
Tweet the Debates
Tweet the DebatesTweet the Debates
Tweet the Debates
 
Synergies Between Search and Social Metrics
Synergies Between Search and Social MetricsSynergies Between Search and Social Metrics
Synergies Between Search and Social Metrics
 
Spinning Online
Spinning OnlineSpinning Online
Spinning Online
 
Video Creativity beyond Dissemination
Video Creativity beyond DisseminationVideo Creativity beyond Dissemination
Video Creativity beyond Dissemination
 
Watch What I Watch
Watch  What  I  WatchWatch  What  I  Watch
Watch What I Watch
 

Recently uploaded

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

SFUSGS

  • 1. @sfusgs Geo-tweet my quake… @ayman • yahoo! research http://en.wikipedia.org/wiki/File:San_francisco_1906_earthquake.jpg
  • 2. Zync • Y! Messenger
  • 13. Trust me, it is just XML
  • 18. The flow was simple CRON this:: cUrl XML feed from USGS find local quakes bit.ly the quake permalink if not duplicate record this quake tweet this quake
  • 19. def fetch_quakes(): def fetch_quakes(): api = bitly.Api(login=’ABCDEF', apikey=’12345678901234567890') rss = parse(urllib.urlopen(USGS_URL)).getroot() quakes = [] for element in rss.findall('{%s}entry' % USGS_NS): title = element.findtext('{%s}title' % USGS_NS) if (title.find("San Francisco Bay") > -1): point = element.findtext('{%s}point' % GEORSS_NS) points = point.split(None, 1) link = element.find('{%s}link' % USGS_NS) href = 'http://earthquakes.usgs.gov%s' % link.get('href') href = api.shorten(href) if (is_duplicate(href) is False): f = open(‘urls.txt', 'a') f.write('%s' % href) f.close() summary = element.findtext('{%s}summary' % USGS_NS) summary = summary.split("<br>")[1] summary = summary.replace(' at epicenter</p><p>', ' ') summary = strip_tags(summary) quakes.append({'title': element.findtext('{%s}title' % USGS_NS), 'link' : href, 'updated' : element.findtext('{%s}updated' % USGS_NS), 'long' : points[1], 'lat' : points[0], 'elev' : element.findtext('{%s}elev' % GEORSS_NS), 'summary' : summary}) return quakes
  • 20. def is_duplicate(url): def is_duplicate(url): from subprocess import call if(os.path.exists(‘urls.txt') is False): call(['/usr/bin/touch', ‘urls.txt']) r = call(['/bin/fgrep', url, ‘urls.txt']) if (r == 0): return True else: return False
  • 21. def send_tweet(t): def send_tweet(t): import httplib2 username = ’ABCDEFG' password = ’12345678901234567890' msg = ('%s %s %s' % (t['title'], t['link'], t['summary'])) http = httplib2.Http() http.add_credentials(username, password) response = http.request( "http://twitter.com/statuses/update.xml", "POST", urllib.urlencode({"status": msg, "lat": t['lat'], "long": t['long']}) ) SEE: http://code.google.com/p/httplib2/ ps: you shouldn’t store your passwords like that…this is just an illustration
  • 22. fin
  • 24. USGS on Open Gov’t
  • 25. Open Questions? How can other local sources be disseminated? How can mass media be filtered so it can be consumed in a similar manner? Can we collect information around the news? For example, find all the tweets that relate to a particular quake. Thanks, @ayman.

Editor's Notes

  1. Use d to be you could look out the window…
  2. I’m from Y!R MESS IEG.
  3. Toms first quake.