Repository: openstates/openstates-scrapers

Issue:
NM failing since at least 2019-03-03
NM has been failing since 2019-03-03

Based on automated runs it appears that NM has not run successfully in 2 days (2019-03-03).


```
  07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Small"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Gallegos, Doreen"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Stansbury"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Stapleton"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Strickler"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Garratt"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Sweetser"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Gonzales"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Thomson"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Townsend"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Herrera"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Hochman"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Trujillo, Jim"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Johnson"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Trujillo, Linda"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Lara"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Zamora"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Lewis"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Pratt"}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Garcma, M.P."}
07:11:12 ERROR pupa: cannot resolve pseudo id to Person: ~{"name": "Harper"}
loaded Open States pupa settings...
nm (scrape, import)
  bills: {}
  votes: {}
import jurisdictions...
import bills...
import vote events...
Traceback (most recent call last):
  File "/opt/**PGUSER**/venv-pupa//bin/pupa", line 11, in <module>
    load_entry_point('pupa', 'console_scripts', 'pupa')()
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/__main__.py", line 68, in main
    subcommands[args.subcommand].handle(args, other)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 278, in handle
    return self.do_handle(args, other, juris)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 329, in do_handle
    report['import'] = self.do_import(juris, args)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 225, in do_import
    report.update(vote_event_importer.import_directory(datadir))
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/importers/base.py", line 196, in import_directory
    return self.import_data(json_stream())
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/importers/base.py", line 233, in import_data
    obj_id, what = self.import_item(data)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/importers/base.py", line 254, in import_item
    data = self.prepare_for_db(data)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/importers/vote_events.py", line 77, in prepare_for_db
    data['bill_id'] = self.bill_importer.resolve_json_id(bill)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/importers/base.py", line 171, in resolve_json_id
    raise UnresolvedIdError(errmsg)
pupa.exceptions.UnresolvedIdError: cannot resolve pseudo id to Bill: ~{"from_organization__classification": "lower", "identifier": "XHB 4", "legislative_session__identifier": "2019"}
```

Visit http://bobsled.openstates.org for more info.



Discussion:

Resolving patch:
diff --git a/openstates/nm/votes.py b/openstates/nm/votes.py
--- a/openstates/nm/votes.py
+++ b/openstates/nm/votes.py
@@ -71,6 +71,8 @@ def correct_name(name):
 
 
 def build_vote(session, bill_id, url, vote_record, chamber, motion_text):
+    # When they vote in a substitute they mark it as XHB
+    bill_id = bill_id.replace('XHB', 'HB')
     passed = len(vote_record['yes']) > len(vote_record['no'])
     vote_event = VoteEvent(
         result='pass' if passed else 'fail',


Test patch: