Repository: openstates/openstates-scrapers

Issue:
AZ: bill status updates
State: AZ
(reported via contact@ email)

We aren't showing any AZ bills as passed this session, I think we're grabbing the actions but not categorizing them.  So most likely AZ actions could use a look- https://openstates.org/az/bills/53rd-1st-regular/HB2262/
 for example




Discussion:

Resolving patch:
diff --git a/openstates/az/action_utils.py b/openstates/az/action_utils.py
--- a/openstates/az/action_utils.py
+++ b/openstates/az/action_utils.py
@@ -9,6 +9,11 @@
     'Veto': 'executive'
 }
 
+status_action_map = {
+    'PASSED': 'passage',
+    'FAILED': 'failure',
+}
+
 action_map = {
     'House1stRead': {'name': 'House First Reading.',
                      'action': ['reading-1']
@@ -23,40 +28,40 @@
                        'action': ['reading-2']
                        },
     'HouseCaucusConcurRefuse': {'name': 'House Caucus Refuse to Concur',
-                                'action': ['']
+                                'action': None,
                                 },
     'HouseConsentCalendarDate': {'name': 'House Placed on Consent Calendar',
-                                 'action': ['']
+                                 'action': None,
                                  },
     'HouseConsentCalendarObject': {'name': '',
-                                   'action': ['']
+                                   'action': None,
                                    },
     'HouseConsentObjectDate': {'name': '',
-                               'action': ['']
+                               'action': None,
                                },
     'HouseMajCaucusDate': {'name': '',
-                           'action': ['']
+                           'action': None,
                            },
     'HouseMajCaucusDate2': {'name': '',
-                            'action': ['']
+                            'action': None,
                             },
     'HouseMajCaucusInd': {'name': '',
-                          'action': ['']
+                          'action': None,
                           },
     'HouseMajCaucusInd2': {'name': '',
-                           'action': ['']
+                           'action': None,
                            },
     'HouseMinCaucusDate': {'name': '',
-                           'action': ['']
+                           'action': None,
                            },
     'HouseMinCaucusDate2': {'name': '',
-                            'action': ['']
+                            'action': None,
                             },
     'HouseMinCaucusInd': {'name': '',
-                          'action': ['']
+                          'action': None,
                           },
     'HouseMinCaucusInd2': {'name': '',
-                           'action': ['']
+                           'action': None,
                            },
     'IntroducedDate': {'name': 'Introduced',
                        'action': ['introduced']
@@ -65,7 +70,7 @@
                     'action': ['filing']
                     },
     'RequestforEnactment': {'name': 'Request for Enactment',
-                            'action': ['']
+                            'action': None,
                             },
     'Senate1stRead': {'name': 'Senate First Reading',
                       'action': ['reading-1']
@@ -80,46 +85,46 @@
                         'action': ['reading-2']
                         },
     'SenateCaucusConcurRefuse': {'name': '',
-                                 'action': ['']
+                                 'action': None,
                                  },
     'SenateConsentCalendarDate': {'name': '',
-                                  'action': ['']
+                                  'action': None,
                                   },
     'SenateConsentCalendarObject': {'name': '',
-                                    'action': ['']
+                                    'action': None,
                                     },
     'SenateConsentObjectDate': {'name': '',
-                                'action': ['']
+                                'action': None,
                                 },
     'SenateMajCaucusDate': {'name': '',
-                            'action': ['']
+                            'action': None,
                             },
     'SenateMajCaucusDate2': {'name': '',
-                             'action': ['']
+                             'action': None,
                              },
     'SenateMajCaucusInd': {'name': '',
-                           'action': ['']
+                           'action': None,
                            },
     'SenateMajCaucusInd2': {'name': '',
-                            'action': ['']
+                            'action': None,
                             },
     'SenateMinCaucusDate': {'name': '',
-                            'action': ['']
+                            'action': None,
                             },
     'SenateMinCaucusDate2': {'name': '',
-                             'action': ['']
+                             'action': None,
                              },
     'SenateMinCaucusInd': {'name': '',
-                           'action': ['']
+                           'action': None,
                            },
     'SenateMinCaucusInd2': {'name': '',
-                            'action': ['']
+                            'action': None,
                             },
     'VetoOverride': {'name': 'Veto Overridden',
-                     'action': ['veto_override-passed']
+                     'action': ['veto-override-passage']
                      },
     # TODO: How do we tell signed from vetoed?
     'GovernorAction': {'name': '',
-                       'action': ['']
+                       'action': None,
                        },
 }
diff --git a/openstates/az/bills.py b/openstates/az/bills.py
--- a/openstates/az/bills.py
+++ b/openstates/az/bills.py
@@ -13,11 +13,6 @@
 
 
 class AZBillScraper(Scraper):
-
-    """
-    Arizona Bill Scraper.
-    """
-    jurisdiction = 'az'
     chamber_map = {'lower': 'H', 'upper': 'S'}
     chamber_map_rev = {'H': 'upper', 'S': 'lower', 'G': 'executive', 'SS': 'executive'}
     chamber_map_rev_eng = {'H': 'House', 'S': 'Senate', 'G': 'Governor',
@@ -124,6 +119,29 @@ def scrape_actions(self, bill, page, self_chamber):
         AZ No longer provides a full list, just a series of keys and dates.
         So map that backwards using action_map
         """
+        for status in page['BillStatusAction']:
+            if status['Action'] in action_utils.status_action_map:
+                category = action_utils.status_action_map[status['Action']]
+                if status['Committee']['TypeName'] == 'Floor':
+                    categories = [category]
+                    if status['Committee']['CommitteeShortName'] == 'THIRD':
+                        categories.append('reading-3')
+                elif status['Committee']['TypeName'] == 'Standing':
+                    categories = ['committee-{}'.format(category)]
+                else:
+                    raise ValueError(
+                        'Unexpected committee type: {}'.format(status['Committee']['TypeName']))
+                action_date = datetime.datetime.strptime(
+                    status['ReportDate'], '%Y-%m-%dT%H:%M:%S').strftime('%Y-%m-%d')
+                bill.add_action(
+                    description=status['Action'],
+                    chamber={
+                        'S': 'upper',
+                        'H': 'lower',
+                    }[status['Committee']['LegislativeBody']],
+                    date=action_date,
+                    classification=categories,
+                )
         for action in action_utils.action_map:
             if page[action] and action_utils.action_map[action]['name'] != '':
                 try:
@@ -134,7 +152,7 @@ def scrape_actions(self, bill, page, self_chamber):
                         chamber=self.actor_from_action(bill, action, self_chamber),
                         description=action_utils.action_map[action]['name'],
                         date=action_date,
-                        classification=str(action_utils.action_map[action]['action'][0])
+                        classification=action_utils.action_map[action]['action'],
                     )
                 except ValueError:
                     self.info("Invalid Action Time {} for {}".format(page[action], action))


Test patch: