LeeMendelowitz / DCMetroMetrics

DC Metro Metrics is a project dedicated to collecting and sharing publicly available data related to the DC WMATA Metrorail system.
GNU General Public License v2.0
40 stars 11 forks source link

Exception while parsing escalator outage station field. #33

Open LeeMendelowitz opened 9 years ago

LeeMendelowitz commented 9 years ago

This exception is being thrown when parsing outage data. Perhaps WMATA is providing malformed data about a station.

We should better handle bad quality data coming from WMATA API.

2015-10-08 07:37:43,254 - ELESApp - ERROR - Traceback:
Traceback (most recent call last):
  File "/home/lmendelo/dcmetrometrics/repo/ELESAppRunner.py", line 66, in _run
    self.app.tick()
  File "/home/lmendelo/dcmetrometrics/repo/dcmetrometrics/eles/ELESApp.py", line 165, in tick
    incidents = getELESIncidents()
  File "/home/lmendelo/dcmetrometrics/repo/dcmetrometrics/eles/ELESApp.py", line 91, in getELESIncidents
    incidents = [Incident(i) for i in incidents]
  File "/home/lmendelo/dcmetrometrics/repo/dcmetrometrics/eles/Incident.py", line 51, in __init__
    self.addAttr()
  File "/home/lmendelo/dcmetrometrics/repo/dcmetrometrics/eles/Incident.py", line 68, in addAttr
    if ',' in stationName:
TypeError: argument of type 'NoneType' is not iterable
LeeMendelowitz commented 9 years ago

The issue is the Metro API is giving this outage with an invalid station code:

{u'DateOutOfServ': u'2015-10-06T06:43:00',
 u'DateUpdated': u'2015-10-06T06:53:46',
 u'DisplayOrder': 0.0,
 u'LocationDescription': u'Escalator - Level 2 to Metro Station',
 u'StationCode': u'T81',
 u'StationName': None,
 u'SymptomCode': None,
 u'SymptomDescription': u'Major Repair',
 u'TimeOutOfService': u'0643',
 u'UnitName': u'T81E02',
 u'UnitStatus': None,
 u'UnitType': u'ESCALATOR'}
LeeMendelowitz commented 9 years ago

I e-mailed api-support@wmata.com. I wonder if 'T81' is the Silver Spring Transit Center.

LeeMendelowitz commented 9 years ago

Pushed temporary fix to branch issue_33