Skip to content

Commit b4fc5a7

Browse files
authored
Merge pull request #22 from VACLab/issue-4-gender-prob-bugfix
Bug fix plus enhancement
2 parents f173ed8 + b79a92e commit b4fc5a7

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

biasanalyzer/database.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def _initialize(self, db_url, omop_db_url=None):
5151
else:
5252
raise ValueError("Unsupported OMOP database backend")
5353

54+
# Set self.schema as default schema
55+
self.conn.execute(f"SET schema '{self.schema}'")
56+
5457
self._create_cohort_definition_table()
5558
self._create_cohort_table()
5659

biasanalyzer/sql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
SELECT
4040
age_bin,
4141
bin_count,
42-
ROUND(bin_count * 1.0 / SUM(bin_count) OVER (), 4) AS probability -- Normalize to get probability
42+
ROUND(bin_count * 1.0 / SUM(bin_count) OVER (), 2) AS probability -- Normalize to get probability
4343
FROM Age_Distribution
4444
ORDER BY age_bin
4545
'''
@@ -73,7 +73,7 @@
7373
SELECT
7474
gender,
7575
COALESCE(gender_count, 0) AS gender_count, -- Ensure that NULL gender counts are treated as 0
76-
ROUND(COALESCE(gender_count, 0) * 100.0 / SUM(COALESCE(gender_count, 0)) OVER (), 2) AS probability
76+
ROUND(COALESCE(gender_count, 0) * 1.0 / SUM(COALESCE(gender_count, 0)) OVER (), 2) AS probability
7777
FROM Gender_Distribution
7878
ORDER BY gender;
7979
'''

0 commit comments

Comments
 (0)