bin/pull_req_data_extraction.rb
def prior_interaction_issue_events(pr, months_back)
    q = <<-QUERY
      select count(distinct(i.id)) as num_issue_events
      from issue_events ie, pull_request_history prh, pull_requests pr, issues i
      where ie.actor_id = prh.actor_id
        and i.repo_id = pr.base_repo_id
        and i.id = ie.issue_id
        and prh.pull_request_id = pr.id
        and prh.action = 'opened'
        and ie.created_at > DATE_SUB(prh.created_at, INTERVAL #{months_back} MONTH)
        and ie.created_at < prh.created_at
        and prh.pull_request_id = ?
    QUERY
    db.fetch(q, pr[:id]).first[:num_issue_events]
  end
# The number of events before a particular pull request that the user has
# participated in for this project.
# The following features originate in:
# Yu, Y., Wang, H., Filkov, V., Devanbu, P., & Vasilescu, B.
# Wait For It: Determinants of Pull Request Evaluation Latency on GitHub.
# MSR 2015
The number of events before a particular pull request that the user has
participated in for this project.
The following features originate in:
Yu, Y., Wang, H., Filkov, V., Devanbu, P., & Vasilescu, B.
Wait For It: Determinants of Pull Request Evaluation Latency on GitHub.
The number of events before a particular pull request that the user has participated in for this project . The following features originate in : Yu Y . Wang H . Filkov V . Devanbu P . & Vasilescu B . Wait For It : Determinants of Pull Request Evaluation Latency on GitHub .
def prior_interaction_issue_events(pr, months_back)
    q = <<-QUERY
      select count(distinct(i.id)) as num_issue_events
      from issue_events ie, pull_request_history prh, pull_requests pr, issues i
      where ie.actor_id = prh.actor_id
        and i.repo_id = pr.base_repo_id
        and i.id = ie.issue_id
        and prh.pull_request_id = pr.id
        and prh.action = 'opened'
        and ie.created_at > DATE_SUB(prh.created_at, INTERVAL #{months_back} MONTH)
        and ie.created_at < prh.created_at
        and prh.pull_request_id = ?
    QUERY
    db.fetch(q, pr[:id]).first[:num_issue_events]
  end
def prior_interaction_issue_events ( pr , months_back ) q = <<-QUERY 
      select count(distinct(i.id)) as num_issue_events
      from issue_events ie, pull_request_history prh, pull_requests pr, issues i
      where ie.actor_id = prh.actor_id
        and i.repo_id = pr.base_repo_id
        and i.id = ie.issue_id
        and prh.pull_request_id = pr.id
        and prh.action = 'opened'
        and ie.created_at > DATE_SUB(prh.created_at, INTERVAL  #{ months_back }  MONTH)
        and ie.created_at < prh.created_at
        and prh.pull_request_id = ?
     QUERY db . fetch ( q , pr [ :id ] ) . first [ :num_issue_events ] end
The number of events before a particular pull request that the user has
participated in for this project.
The number of events before a particular pull request that the user has participated in for this project .
pr
months_back