datamade / nmid-scrapers

Scrapers for NMID
MIT License
0 stars 0 forks source link

Extend lobbyist scrape to capture lobbyist employer expenditures and contributions #15

Open hancush opened 10 months ago

hancush commented 10 months ago

Likely to take place in Phase 2.

Start from https://login.cfis.sos.state.nm.us/api//ExploreClients/SearchClients

Payload:

{
    "ElectionYear": "2023,2022,2021",
    "BusinessType": null,
    "TransactionType": null,
    "TransactionAmount": "0.01",
    "EmployerName": null,
    "LobbyistOver": null,
    "IsCompliance": null,
    "PageNo": 1,
    "PageSize": 10,
    "SortDir": "ASC",
    "SortedBy": "",
    "IsWidgetDisplay": 0
}

Example response:

[{"ClientID":"FKuMVncaDIPPXu2BBY9jdYIAq4bYqsgWASqUMLp00XI1","ClientVersionID":2,"ClientName":"AFSCME Council 18","NumberOfLobbyists":3,"TotalCompensationAmount":0.00,"BusinessType":"Other","Address":"1202 Pennsylvania Street NE, Albuquerque, NM 87110","Members":null,"FilingYear":2021,"TotalRows":192,"RowNumber":null,"TotalContributions":10500.00,"TotalExpenditures":0.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"FKuMVncaDIPPXu2BBY9jdYIAq4bYqsgWASqUMLp00XI1","ClientVersionID":3,"ClientName":"AFSCME Council 18","NumberOfLobbyists":3,"TotalCompensationAmount":0.00,"BusinessType":"Other","Address":"1202 Pennsylvania Street NE, Albuquerque, NM 87110","Members":null,"FilingYear":2022,"TotalRows":192,"RowNumber":null,"TotalContributions":10500.00,"TotalExpenditures":0.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"FKuMVncaDIPPXu2BBY9jdYIAq4bYqsgWASqUMLp00XI1","ClientVersionID":4,"ClientName":"AFSCME Council 18","NumberOfLobbyists":3,"TotalCompensationAmount":0.00,"BusinessType":"Other","Address":"1202 Pennsylvania Street NE, Albuquerque, NM 87110","Members":null,"FilingYear":2023,"TotalRows":192,"RowNumber":null,"TotalContributions":10500.00,"TotalExpenditures":0.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"jsUN_8A_FHbMEr9Hzrei74IAq4bYqsgWASqUMLp00XI1","ClientVersionID":2,"ClientName":"Allstate insurance Company","NumberOfLobbyists":6,"TotalCompensationAmount":0.00,"BusinessType":"Finance, Insurance","Address":"2775 Sanders Road, Ste. A2W, Northbrook, IL 60062","Members":null,"FilingYear":2021,"TotalRows":192,"RowNumber":null,"TotalContributions":198750.00,"TotalExpenditures":0.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"jsUN_8A_FHbMEr9Hzrei74IAq4bYqsgWASqUMLp00XI1","ClientVersionID":5,"ClientName":"Allstate insurance Company","NumberOfLobbyists":6,"TotalCompensationAmount":0.00,"BusinessType":"Finance, Insurance","Address":"2775 Sanders Road, Ste. A2W, Northbrook, IL 60062","Members":null,"FilingYear":2022,"TotalRows":192,"RowNumber":null,"TotalContributions":198750.00,"TotalExpenditures":0.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"jsUN_8A_FHbMEr9Hzrei74IAq4bYqsgWASqUMLp00XI1","ClientVersionID":9,"ClientName":"Allstate insurance Company","NumberOfLobbyists":6,"TotalCompensationAmount":0.00,"BusinessType":"Finance, Insurance","Address":"3100 Sanders Road, Ste. 201, Northbrook, IL 60062","Members":null,"FilingYear":2023,"TotalRows":192,"RowNumber":null,"TotalContributions":198750.00,"TotalExpenditures":0.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"hzXS-mvFz84b0rI0of6p8oIAq4bYqsgWASqUMLp00XI1","ClientVersionID":1,"ClientName":"American Council of Life Insurers","NumberOfLobbyists":3,"TotalCompensationAmount":0.00,"BusinessType":"Finance, Insurance","Address":"101 Constitution Ave, NW, Washington, NM 20001","Members":null,"FilingYear":2021,"TotalRows":192,"RowNumber":null,"TotalContributions":12525.00,"TotalExpenditures":72.57,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"hzXS-mvFz84b0rI0of6p8oIAq4bYqsgWASqUMLp00XI1","ClientVersionID":2,"ClientName":"American Council of Life Insurers","NumberOfLobbyists":3,"TotalCompensationAmount":0.00,"BusinessType":"Finance, Insurance","Address":"101 Constitution Ave, NW, Washington, NM 20001","Members":null,"FilingYear":2022,"TotalRows":192,"RowNumber":null,"TotalContributions":12525.00,"TotalExpenditures":72.57,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"hzXS-mvFz84b0rI0of6p8oIAq4bYqsgWASqUMLp00XI1","ClientVersionID":5,"ClientName":"American Council of Life Insurers","NumberOfLobbyists":3,"TotalCompensationAmount":0.00,"BusinessType":"Finance, Insurance","Address":"101 Constitution Ave, NW, Suite 700, Washington, DC 20001","Members":null,"FilingYear":2023,"TotalRows":192,"RowNumber":null,"TotalContributions":12525.00,"TotalExpenditures":72.57,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null},{"ClientID":"_jMYCYbvcMwiCGfautTE3oIAq4bYqsgWASqUMLp00XI1","ClientVersionID":3,"ClientName":"American Federation of State, County and Municipal Employees","NumberOfLobbyists":1,"TotalCompensationAmount":0.00,"BusinessType":"Other","Address":"1625 L Street, NW, Washington, DC 20036","Members":null,"FilingYear":2021,"TotalRows":192,"RowNumber":null,"TotalContributions":426600.00,"TotalExpenditures":2041368.00,"IsCompliant":0,"CreatedBy":null,"CreatedDate":null,"CreatedIPAddress":null,"LobbyistClientID":null,"LobbyistClientVersionID":null,"LastModifiedBy":null,"LastModifiedDate":null,"LastModifiedIPAddress":null,"Message":null,"IsSuccess":0,"Action":null,"IsDirty":0,"PersonID":null,"PersonVersionID":null}]

You'll have to paginate through results, then walk the distinct list of lobbyist employers to retrieve filings for parsing. The filings look identical to individual lobbyist filings, so you should be able to reuse that code (and likely a lot of the scraping code, as well).