-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from levshuster/Database-Based
Database based
- Loading branch information
Showing
14 changed files
with
634 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
SELECT count(*) AS count_of_joined_votes FROM ( | ||
SELECT value, partial_name, lower(name), first_name, pairing.debater.team | ||
FROM pairing.speaker_points | ||
LEFT JOIN pairing.debater | ||
ON pairing.debater.team = speaker_points.team | ||
WHERE lower(name) LIKE '%' || partial_name || '%' | ||
ORDER BY pairing.debater.team | ||
) as a; | ||
|
||
SELECT count(*) AS vote_count FROM pairing.speaker_points; | ||
|
||
-- Counts are off there are some double counts going on but its only off 1% of the time | ||
|
||
CREATE TEMP VIEW speaker_points_and_gender AS | ||
SELECT | ||
name, | ||
pairing.debater.first_name, | ||
value AS speaker_points, | ||
female_count, | ||
male_count, | ||
pairing.speaker_points.division, | ||
CASE | ||
WHEN female_count IS NULL THEN 'Unknown - Name Not in DB' | ||
WHEN female_count + male_count < 20 THEN 'Unknown - Too Few Names' | ||
WHEN LEAST(female_count, male_count) + ((female_count+male_count)/10) > GREATEST(female_count, male_count) THEN 'Unknown - Small Difference Between Counts' | ||
WHEN female_count > male_count THEN 'Female' | ||
WHEN male_count > female_count THEN 'Male' | ||
ELSE 'Error gender case never matched' | ||
END AS gender | ||
FROM pairing.speaker_points | ||
LEFT JOIN pairing.debater | ||
ON pairing.debater.team = speaker_points.team | ||
LEFT JOIN gender_binding | ||
ON lower(gender_binding.first_name) = lower(pairing.debater.first_name) | ||
WHERE lower(name) LIKE '%' || partial_name || '%' | ||
AND value < 35 | ||
ORDER BY name; | ||
|
||
SELECT female_count IS NOT NULL AS debater_gender_found, count(*) | ||
FROM speaker_points_and_gender | ||
GROUP BY female_count IS NOT NULL; | ||
|
||
-- SELECT * from speaker_points_and_gender WHERE female_count IS NULL; | ||
|
||
|
||
SELECT * FROM speaker_points_and_gender; | ||
|
||
SELECT gender, count(*), AVG(speaker_points), STDDEV(speaker_points) | ||
FROM speaker_points_and_gender | ||
GROUP BY gender; | ||
|
||
SELECT | ||
gender, | ||
speaker_points | ||
FROM speaker_points_and_gender | ||
WHERE gender IN ('Male', 'Female'); | ||
|
||
-- SELECT * FROM gender_binding; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ sqlalchemy==2.0.34 | |
beautifulsoup4==4.12.3 | ||
lxml==5.3.0 | ||
plotly==5.24.1 | ||
scipy==1.10.1 |
Oops, something went wrong.