Skip to content

Commit

Permalink
update: drh metrics sql #29
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetAnithaVarghese committed Oct 7, 2024
1 parent a35db07 commit 3961e10
Show file tree
Hide file tree
Showing 3 changed files with 424 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DB } from "https://deno.land/x/sqlite/mod.ts";
const dbFilePath = "resource-surveillance.sqlite.db";

// Function to create a combined view of CGM tracing
export function createCombinedView() {

// Open the existing database
const db = new DB(dbFilePath);
console.log(`Opened database: ${dbFilePath}`);
Expand Down Expand Up @@ -88,13 +88,18 @@ export function createCombinedView() {
const combinedUnionAllQuery = sqlParts.join(' UNION ALL ');
const createCombinedViewSql = `CREATE VIEW IF NOT EXISTS combined_cgm_tracing AS ${combinedUnionAllQuery};`;
//console.log(`Creating combined view with SQL:\n${createCombinedViewSql}`);

//return createCombinedViewSql;
db.execute(createCombinedViewSql);
// db.close();

console.log("Combined view 'combined_cgm_tracing' created successfully.");

} else {
console.log("No participant tables found, so the combined view will not be created.");
}

// Close the database connection
db.close();
db.close();
console.log(`Closed database: ${dbFilePath}`);
}
Loading

0 comments on commit 3961e10

Please sign in to comment.