Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions biasanalyzer/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def _initialize(self, db_url, omop_db_url=None):
else:
raise ValueError("Unsupported OMOP database backend")

# Set self.schema as default schema
self.conn.execute(f"SET schema '{self.schema}'")

self._create_cohort_definition_table()
self._create_cohort_table()

Expand Down
4 changes: 2 additions & 2 deletions biasanalyzer/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
SELECT
age_bin,
bin_count,
ROUND(bin_count * 1.0 / SUM(bin_count) OVER (), 4) AS probability -- Normalize to get probability
ROUND(bin_count * 1.0 / SUM(bin_count) OVER (), 2) AS probability -- Normalize to get probability
FROM Age_Distribution
ORDER BY age_bin
'''
Expand Down Expand Up @@ -73,7 +73,7 @@
SELECT
gender,
COALESCE(gender_count, 0) AS gender_count, -- Ensure that NULL gender counts are treated as 0
ROUND(COALESCE(gender_count, 0) * 100.0 / SUM(COALESCE(gender_count, 0)) OVER (), 2) AS probability
ROUND(COALESCE(gender_count, 0) * 1.0 / SUM(COALESCE(gender_count, 0)) OVER (), 2) AS probability
FROM Gender_Distribution
ORDER BY gender;
'''
Expand Down