Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query suggestion (difference between asked and received consent and basis_for_search is consent was given) #27

Open
chekos opened this issue May 5, 2020 · 2 comments
Assignees
Labels
suggestion A canned query suggestion (to be included by default in future deployment)

Comments

@chekos
Copy link
Owner

chekos commented May 5, 2020

🤔🤔🤔🤔🤔🤔

query

SELECT 
  race_ethnicity,
  PRINTF('%.2f', person_consented_to_search*1.0 / searched_person) as share_consented,
  PRINTF('%.2f', bfs_consent_given*1.0 / searched_person) as bfs_share_consented,
  PRINTF('%.2f', bfs_consent_given*1.0 / searched_person - person_consented_to_search*1.0 / searched_person) as difference_in_consents,
  searched_person
FROM 
(SELECT
  rae_codes.RACE_ETHNICITY as race_ethnicity,
  SUM(ADS_ASKED_SEARCH_PER) as asked_person_for_consent,
  SUM(ADS_SEARCH_PERS_CONSEN) as person_consented_to_search,
  SUM(ADS_SEARCH_PERSON) as searched_person,
  SUM(bfs.BFS_CONSENT_GIVEN) as bfs_consent_given,
  COUNT(main.REASON_FOR_STOP) as rfs_consentual_encounter_consentual_search
FROM
  action_taken AS at
  INNER JOIN race_ethnicity AS rae ON rae.UNIQUE_ID = at.UNIQUE_ID
  INNER JOIN basis_for_search AS bfs ON bfs.UNIQUE_ID = rae.UNIQUE_ID
  INNER JOIN race_ethnicity_codes AS rae_codes ON rae.RAE_FULL = rae_codes.CODE
  LEFT JOIN (
    SELECT
      UNIQUE_ID,
      REASON_FOR_STOP
    FROM
      aa_main_table
    WHERE
      REASON_FOR_STOP = 6
  ) AS main ON main.UNIQUE_ID = rae.UNIQUE_ID
GROUP BY
  rae.RAE_FULL)
@chekos chekos added the suggestion A canned query suggestion (to be included by default in future deployment) label May 5, 2020
@chekos
Copy link
Owner Author

chekos commented May 5, 2020

Screen Shot 2020-05-05 at 4 45 56 PM

@chekos chekos self-assigned this May 5, 2020
@chekos
Copy link
Owner Author

chekos commented May 5, 2020

Difference between Action taken by officer during stop: specify if consent was given for search of person and Basis for search: consent given by race/ethnicity

visualization (2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion A canned query suggestion (to be included by default in future deployment)
Projects
None yet
Development

No branches or pull requests

1 participant