-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors the profile route and related utils for increased clarity
- Loading branch information
jhogan
committed
Apr 18, 2019
1 parent
6e140ba
commit a7f6180
Showing
94 changed files
with
2,679 additions
and
9,447 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
SELECT | ||
sum, | ||
m, | ||
cv, | ||
universe_sum, | ||
universe_m, | ||
profile, | ||
category, | ||
base, | ||
profile.variable | ||
FROM ( | ||
SELECT | ||
--- sum --- | ||
SUM(e) AS sum, | ||
--- m --- | ||
SQRT(SUM(POWER(m, 2))) AS m, | ||
--- cv (uses m & sum, recomputed) --- | ||
(((SQRT(SUM(POWER(m, 2))) / 1.645) / NULLIF(SUM(e), 0)) * 100) AS cv, | ||
profile, | ||
category, | ||
base, | ||
LOWER(variable) as variable | ||
FROM economic p | ||
INNER JOIN factfinder_metadata ffm | ||
ON p.variable = ffm.variablename | ||
WHERE p.geoid IN ('SI05') | ||
AND p.dataset = 'Y2006-2010' | ||
GROUP BY variable, base, category, profile | ||
ORDER BY variable, base, category | ||
) profile | ||
LEFT JOIN ( | ||
SELECT | ||
SUM(e) as universe_sum, | ||
SQRT(SUM(POWER(m, 2))) as universe_m, | ||
LOWER(variable) as variable | ||
FROM economic base | ||
WHERE base.dataset = 'Y2006-2010' | ||
GROUP BY variable | ||
) universe | ||
ON profile.variable = universe.variable; | ||
|
Oops, something went wrong.