GithubHelp home page GithubHelp logo

lobby_edge2vec's Introduction

lobby_edge2vec

Edge embedding to measure distance between two edges

Notions

Cash flows are represented in a directed graph who gives how much to whom. Then the recipient node also pays his income to another node. Then I'd like to figure out how much those two edges are related - in other word, X% of this money money flow originated from this one.

Resources

Learning Edge Representations via Low-Rank Asymmetric Projections https://arxiv.org/pdf/1705.05615.pdf

Known facts

  • In general, randomwalk methods outperform “eigen” methods on producing vector representations that preserve the graph structure.

List of information about who gives money to whom

Corporation pays to Registrants or its in-house lobbying team. For example, if the company is Ameriquest

  1. Get _client_uuid
  • Assume we are interested in the company named Ameriquest Mortgage
select *
from lobbying_clients__infogroup_companies.clients__infogroup_id___rough ciir 
where ciir.client_full_name_used ilike '%ameriquest%'
>>> "_client_uuid"	client_full_name_used	infogroup_id
>>> 8f0f26aa-6410-5f0e-9d4b-2229d5324ac8	AMERIQUEST MORTGAGE COMPANY	424328982
  1. Client pays money to lobbyists or registrants
select c."client_full_name", regist."registrant_full_name", r.amount, i.issue_code, ic.issue_code_description 
from consolidated_layer_reports.reports r 
	inner join consolidated_layer_reports.clients as c using ("_client_uuid" )
	inner join consolidated_layer_reports.registrants as regist using ("_registrant_uuid")
	inner join consolidated_layer_reports.issues as i using ("_report_uuid")
	inner join consolidated_layer_reports.issues_code__reference as ic using ("issue_code")
where c.client_full_name ILIKE '%Ameriquest%'
order by amount desc
>>>client_full_name	registrant_full_name	amount	issue_code	issue_code_description
>>>AMERIQUEST MORTGAGE CO	OGILVY GOVERNMENT RELATIONS	$240,000.00	BAN	Banking

2-1. Or, sometimes self pays(expenses) to oneself for its own lobbying purpose

-- with the same query above,
>>>client_full_name	registrant_full_name	amount	issue_code	issue_code_description
>>>AMERIQUEST MORTGAGE CO	AMERIQUEST MORTGAGE CO	$20,000.00	BAN	Banking

2-2. Thus, more generally, under the context of lobbying, entities are giving money from one to another, and also, gives money to itself.

Remember, Money means On Behalf Of.

  1. PAC and its Legislative Activity

Now we want to know which PAC server for which purpose. For example, we want to know what Halvorson for Congress does in the congress and why/how do they get those money from Safari Club Int'l via Ogilvy upon their legislative action. To do that, we need to find who's the recipient of the

select distinct cc.sub_id, c.committee_name, c.committee_id, c.report_year, cc.report_year, cc.candidate_id, cd.candidate_name, cc.tran_amount
from relational_layer_campaign.committee___clean c
	inner join relational_layer_campaign.committee_to_candidate_contribution___clean cc on cc.committee_id = c.committee_id and cc.report_year = c.report_year
	inner join relational_layer_campaign.candidate cd on cd.candidate_id= c.candidate_id and cd.report_year = c.report_year 
where c.committee_name ilike '%halvorson for congress%'
>>> sub_id	committee_name	committee_id	report_year	report_year	candidate_id	candidate_name	tran_amount
>>> 4050220131188538966	HALVORSON FOR CONGRESS	C00539932	2014	2014	H8IL11113	HALVORSON, DEBORAH L	$1,000.00
4050220131188538969	HALVORSON FOR CONGRESS	C00539932	2014	2014	H8AZ01104	HALVORSON, DEBORAH L	$1,000.00
4050720091114699887	HALVORSON FOR CONGRESS	C00440016	2008	2008	H8LA04241	HALVORSON, DEBORAH 'DEBBIE'	$2,000.00
4072920111141824811	HALVORSON FOR CONGRESS	C00440016	2012	2012	H6NC08111	HALVORSON, DEBORAH	$2,500.00

or, more simply just using ld203, we can find the payee, who's gonna be the recipient of the money contributed through the path of PAC -> Ogilvy -> PAC

select cd.organization_name, cb.contributor_name, cb.payee_name, cb.amount, cb.recipient_name 
from relational___campaign.contributiondisclosure cd
	inner join relational___campaign.contributions cb using ("ld203_uuid")
where cd.organization_name ilike '%Ogilvy%' and cb.contributor_name ilike '%Safari%' and cb.payee_name ilike '%halvorson%'
order by amount desc
>> organization_name	contributor_name	payee_name	amount	recipient_name
>> Ogilvy Government Relations	Safari Club International PAC	Halvorson For Congress	$5,000.00	Deborah L. Halvorson

Now, we can retrieve the bioguide_id, the legislator's identifier, with the name, `Deborah L. Halvorson'.

select *
from consolidated_layer_bills.legislators l 
where last_name ilike '%halvorson%' and first_name ilike '%deborah%'
>>> bioguide_id	first_name	last_name
>>> H001044	Deborah	Halvorson

And then, we the bioguide_id, we can search for her legislative actios history:

select distinct b.bill_sponsor_id, s.subject_name, b.bill_id, b.congress_session, t.bill_title, b.bill_summary, b.bill_introduced_datetime, b.bill_date_updated
from consolidated_layer_bills.bills b
	inner join consolidated_layer_bills.titles t using ("bill_id", "congress_session")
	inner join consolidated_layer_bills.subjects s using ("bill_id", "congress_session")
where bill_sponsor_id = 'H001044'

or, for searching of cosponsor with the Debora L. Halvorson's bioguide_id, H001044

select distinct cs.cosponsor_id, s.subject_name, b.bill_id, b.congress_session, t.bill_title, b.bill_introduced_datetime, b.bill_date_updated
from consolidated_layer_bills.bills b
	inner join consolidated_layer_bills.titles t using ("bill_id", "congress_session") --b.bill_id = t.bill_id and b.congress_session =t.congress_session 
	inner join consolidated_layer_bills.subjects s using ("bill_id", "congress_session")
	inner join consolidated_layer_bills.cosponsors cs using ("bill_id", "congress_session")
where cs.cosponsor_id = 'H001044' and '%animal%' ilike t.bill_title 

lobby_edge2vec's People

Contributors

syyunn avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.