Skip to content

Commit

Permalink
deploy: 862f3e6
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetAnithaVarghese committed Oct 21, 2024
1 parent 394aeeb commit dba9398
Show file tree
Hide file tree
Showing 145 changed files with 266 additions and 85 deletions.
4 changes: 2 additions & 2 deletions 404.html

Large diffs are not rendered by default.

Binary file modified 404.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/advanced-polyglot-orchestration/index.html

Large diffs are not rendered by default.

Binary file modified blog/advanced-polyglot-orchestration/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/direct-messaging-service-pattern/index.html

Large diffs are not rendered by default.

Binary file modified blog/direct-messaging-service-pattern/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/evidence-based-decision-making-pattern/index.html

Large diffs are not rendered by default.

Binary file modified blog/evidence-based-decision-making-pattern/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/index.html

Large diffs are not rendered by default.

Binary file modified blog/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/power-of-sql-and-sql-views/index.html

Large diffs are not rendered by default.

Binary file modified blog/power-of-sql-and-sql-views/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/quality-management-pattern/index.html

Large diffs are not rendered by default.

Binary file modified blog/quality-management-pattern/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/rssd-excel-portability-sql-power/index.html

Large diffs are not rendered by default.

Binary file modified blog/rssd-excel-portability-sql-power/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/sql-based-etl-elt/index.html

Large diffs are not rendered by default.

Binary file modified blog/sql-based-etl-elt/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/surveilr-core-vs-patterns/index.html

Large diffs are not rendered by default.

Binary file modified blog/surveilr-core-vs-patterns/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/surveilr-integration-engine/index.html

Large diffs are not rendered by default.

Binary file modified blog/surveilr-integration-engine/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/vendor-assessments/index.html

Large diffs are not rendered by default.

Binary file modified blog/vendor-assessments/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions blog/why-stateful-integration/index.html

Large diffs are not rendered by default.

Binary file modified blog/why-stateful-integration/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions contact/index.html

Large diffs are not rendered by default.

Binary file modified contact/index.html.br
Binary file not shown.
6 changes: 3 additions & 3 deletions index.html

Large diffs are not rendered by default.

Binary file modified index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions insights/insight-1/index.html

Large diffs are not rendered by default.

Binary file modified insights/insight-1/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions insights/insight-2/index.html

Large diffs are not rendered by default.

Binary file modified insights/insight-2/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions insights/insight-3/index.html

Large diffs are not rendered by default.

Binary file modified insights/insight-3/index.html.br
Binary file not shown.
4 changes: 2 additions & 2 deletions insights/why-sqlite-for-rssd/index.html

Large diffs are not rendered by default.

Binary file modified insights/why-sqlite-for-rssd/index.html.br
Binary file not shown.
31 changes: 14 additions & 17 deletions lib/service/diabetes-research-hub/drhctl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const dbFilePath = "resource-surveillance.sqlite.db"; // Path to your SQLite DB

const RSC_BASE_URL = "https://raw.githubusercontent.com/surveilr/www.surveilr.com/main/lib/service/diabetes-research-hub";
const UX_URL = "https://www.surveilr.com/lib/service/diabetes-research-hub";
//const UX_URL = "http://localhost:4321/lib/service/diabetes-research-hub";



Expand Down Expand Up @@ -225,21 +226,17 @@ try {
}


// This function retrieves the SQL script for data de-identification.
// Note: Deidentification functions are only available through the `surveilr shell` or `surveilr orchestrate` commands.
// Issues prevail while executing these commands on Windows OS.
// Therefore avoiding deidentification till the issue is resolved
// try {
// console.log(colors.dim(`Performing DeIdentification: ${folderName}...`));
// await executeCommand(
// [toolCmd, "orchestrate", "-n", "deidentification"],
// deidentificationSQLSupplier,
// );
// console.log(colors.green("Deidentification successful."));
// } catch (error) {
// console.error(colors.cyan("Error during DeIdentification:"), error.message);
// //Deno.exit(1);
// }
try {
console.log(colors.dim(`Performing DeIdentification: ${folderName}...`));
await executeCommand(
[toolCmd, "orchestrate", "-n", "deidentification"],
deidentificationSQLSupplier,
);
console.log(colors.green("Deidentification successful."));
} catch (error) {
console.error(colors.cyan("Error during DeIdentification:"), error.message);
//Deno.exit(1);
}

// This function is for the dynamic combined view generation
// try {
Expand All @@ -252,8 +249,8 @@ try {

try {
console.log(colors.dim(`Performing UX orchestration: ${folderName}...`));
//await executeCommand([toolCmd, "shell"], uxSQLSupplier);
executeSqlCommands(uxSQL); // Execute UX SQL commands
await executeCommand([toolCmd, "shell"], uxSQLSupplier);
//executeSqlCommands(uxSQL); // Execute UX SQL commands
console.log(colors.green("UX orchestration completed successfully."));
} catch (error) {
console.error(colors.cyan("Error during UX orchestration:"), error.message);
Expand Down
79 changes: 65 additions & 14 deletions lib/service/diabetes-research-hub/package.sql.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-run --allow-sys
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-run --allow-sys --allow-ffi
import { sqlPageNB as spn } from "./deps.ts";
import {
console as c,
Expand All @@ -8,6 +8,7 @@ import {
} from "../../std/web-ui-content/mod.ts";

import * as sppn from "../..//std/notebook/sqlpage.ts";
import { createUVACombinedCGMViewSQL,generateDetrendedDSCombinedCGMViewSQL } from './study-specific-stateless/generate-cgm-combined-sql.ts';

// custom decorator that makes navigation for this notebook type-safe
function drhNav(route: Omit<spn.RouteConfig, "path" | "parentPath">) {
Expand Down Expand Up @@ -154,6 +155,15 @@ export class DRHSqlPages extends spn.TypicalSqlPageNotebook {
`;
}

combinedViewDDL()
{
const dbFilePath = "./resource-surveillance.sqlite.db";
const sqlStatements= createUVACombinedCGMViewSQL(dbFilePath);
return this.SQL`
${sqlStatements}
`;
}

@spn.navigationPrimeTopLevel({
caption: "DRH EDGE UI Home",
description: "Welcome to Diabetes Research Hub EDGE UI",
Expand Down Expand Up @@ -204,7 +214,7 @@ export class DRHSqlPages extends spn.TypicalSqlPageNotebook {
SELECT
'card' as component,
'Features ' as title,
8 as columns;
9 as columns;
SELECT
Expand Down Expand Up @@ -269,6 +279,13 @@ export class DRHSqlPages extends spn.TypicalSqlPageNotebook {
'book' as icon,
'red' as color;
SELECT
'Combined CGM Tracing' AS title,
'/drh/cgm-combined-data/index.sql' AS link,
'Explore the comprehensive CGM dataset, integrating glucose monitoring data from all participants for in-depth analysis of glycemic patterns and trends across the study.' AS description,
'book' as icon,
'red' as color;
SELECT
'PHI De-Identification Results' AS title,
Expand Down Expand Up @@ -501,6 +518,51 @@ This section provides information about the publications resulting from a study.
`;
}


@drhNav({
caption: "Combined CGM Tracing",
abbreviatedCaption: "Combined CGM Tracing",
description: "Combined CGM Tracing",
siblingOrder: 21,
})
"drh/cgm-combined-data/index.sql"() {
const viewName = `combined_cgm_tracing`;
const pagination = this.pagination({ tableOrViewName: viewName });
return this.SQL`
${this.activePageTitle()}
SELECT
'text' as component,
'
The **Combined CGM Tracing** refers to a consolidated dataset of continuous glucose monitoring (CGM) data, collected from multiple participants in a research study. CGM devices track glucose levels at regular intervals throughout the day, providing detailed insights into the participants'' glycemic control over time.
In a research study, this combined dataset is crucial for analyzing glucose trends across different participants and understanding overall patterns in response to interventions or treatments. The **Combined CGM Tracing** dataset typically includes:
- **Participant ID**: A unique identifier for each participant, ensuring the data is de-identified while allowing for tracking individual responses.
- **Date_Time**: The timestamp for each CGM reading, formatted uniformly to allow accurate time-based analysis.(YYYY-MM-DD HH:MM:SS)
- **CGM_Value**: The recorded glucose level at each time point, often converted to a standard unit (e.g., mg/dL or mmol/L) and stored as a real number for precise calculations.
This combined view enables researchers to perform comparative analyses, evaluate glycemic variability, and assess overall glycemic control across participants, which is essential for understanding the efficacy of treatments or interventions in the study. By aggregating data from multiple sources, researchers can identify population-level trends while maintaining the integrity of individual data.
' as contents_md;
${pagination.init()}
-- Display uniform_resource table with pagination
SELECT 'table' AS component,
TRUE AS sort,
TRUE AS search;
SELECT * FROM ${viewName}
LIMIT $limit
OFFSET $offset;
${pagination.renderSimpleMarkdown()}
`;
}


@drhNav({
caption: "CGM File MetaData Information",
abbreviatedCaption: "CGM File MetaData Information",
Expand Down Expand Up @@ -1038,19 +1100,8 @@ Participants are individuals who volunteer to take part in CGM research studies.

export async function drhSQL() {
return await spn.TypicalSqlPageNotebook.SQL(
new class extends spn.TypicalSqlPageNotebook {

new class extends spn.TypicalSqlPageNotebook {

// async deidentifyDRHSQL() {
// // This function retrieves the SQL script for data de-identification.
// // Note: Deidentification functions are only available through the `surveilr shell` or `surveilr orchestrate` commands.
// // Issues prevail while executing these commands on Windows OS.
// return await spn.TypicalSqlPageNotebook.fetchText(
// import.meta.resolve(
// "./orchestration/deidentification-orchestration.sql",
// ),
// );
// }

async vandvDRHSQL() {
// This function retrieves the SQL script for verfication and validation
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env --allow-run --allow-net

import { Database } from "https://deno.land/x/sqlite3@0.12.0/mod.ts";

// Common function to log errors into the database
function logError(db: Database, errorMessage: string): void {
db.exec(`CREATE TABLE IF NOT EXISTS error_log (
errorLogId INTEGER PRIMARY KEY AUTOINCREMENT,
datetime TEXT DEFAULT (datetime('now')),
error_message TEXT
);`);

const params = JSON.stringify({ message: errorMessage });
db.prepare("INSERT INTO error_log (error_message) VALUES (?);").run(params);
}

// Function to create the initial view and return SQL for combined CGM tracing view (first dataset)
export function createUVACombinedCGMViewSQL(dbFilePath: string): string {
const db = new Database(dbFilePath);

try {
// Execute the initial view
db.exec(`DROP VIEW IF EXISTS drh_participant_file_names;`);
db.exec(`
CREATE VIEW drh_participant_file_names AS
SELECT patient_id, GROUP_CONCAT(file_name, ', ') AS file_names
FROM uniform_resource_cgm_file_metadata
GROUP BY patient_id;
`);
//console.log("View 'drh_participant_file_names' created successfully.");
} catch (error) {
//console.error("Error creating view 'drh_participant_file_names':", error);
logError(db, error.message);
db.close();
return "";
}

const participantsStmt = db.prepare("SELECT DISTINCT patient_id FROM drh_participant_file_names;");
const participants = participantsStmt.all();

const sqlParts: string[] = [];
for (const { patient_id } of participants) {
const fileNamesStmt = db.prepare("SELECT file_names FROM drh_participant_file_names WHERE patient_id = ?;");
const file_names_row = fileNamesStmt.get(patient_id);

if (!file_names_row) {
//console.log(`No file names found for participant ${patient_id}.`);
continue;
}

const file_names = file_names_row.file_names;
if (file_names) {
const participantTableNames = file_names.split(', ').map(fileName => `uniform_resource_${fileName}`);
participantTableNames.forEach(tableName => {
sqlParts.push(`
SELECT
'${patient_id}' as participant_id,
strftime('%Y-%m-%d %H:%M:%S', date_time) as Date_Time,
CAST(CGM_Value as REAL) as CGM_Value
FROM ${tableName}
`);
});
}
fileNamesStmt.finalize();
}

let combinedViewSQL = '';
if (sqlParts.length > 0) {
const combinedUnionAllQuery = sqlParts.join(' UNION ALL ');
combinedViewSQL = `CREATE VIEW combined_cgm_tracing AS ${combinedUnionAllQuery};`;
} else {
//console.log("No participant tables found, so the combined view will not be created.");
}

participantsStmt.finalize();
db.close();

return combinedViewSQL; // Return the SQL string instead of executing it
}

// Function to generate the combined CGM tracing view SQL for the second dataset
export function generateDetrendedDSCombinedCGMViewSQL(dbFilePath: string): string {
const db = new Database(dbFilePath);

const tablesStmt = db.prepare("SELECT name AS table_name FROM sqlite_master WHERE type = 'table' AND name LIKE 'uniform_resource_case__%'");
const tables = tablesStmt.all();
const sqlParts: string[] = [];

// Loop through each table and generate the SQL for their CGM data
for (const { table_name } of tables) {
const participantId = table_name.split('__').pop(); // Extract participant ID from the table name

// Generate SQL for each participant's CGM data
sqlParts.push(`
SELECT
'${participantId}' AS participant_id,
TRIM('2012-01-01 ' || hora ) AS Date_Time,
CAST(glucemia AS REAL) AS CGM_Value
FROM ${table_name}
`);
}

let combinedViewSQL = '';
if (sqlParts.length > 0) {
const combinedUnionAllQuery = sqlParts.join(' UNION ALL ');
combinedViewSQL = `CREATE VIEW combined_cgm_tracing AS ${combinedUnionAllQuery};`;
} else {
//console.log("No participant tables found, so the combined view will not be created.");
}

db.close();

return combinedViewSQL; // Return the SQL string instead of executing it
}

// If the script is being run directly, execute the functions
if (import.meta.main) {
const dbFilePath = "resource-surveillance.sqlite.db";

// Run the first dataset view creation and get the SQL for combined view
const dclp1combinedCGMViewSQL= createUVACombinedCGMViewSQL(dbFilePath);
if (dclp1combinedCGMViewSQL) {
console.log("Generated SQL for DCLP1 Study dataset:");
console.log(dclp1combinedCGMViewSQL);
}

// Generate and log the SQL for the second dataset
const detrendedDSCombinedCGMViewSQL = generateDetrendedDSCombinedCGMViewSQL(dbFilePath);
if (detrendedDSCombinedCGMViewSQL) {
console.log("Generated SQL for detrended fluctuation analysis dataset:");
console.log(detrendedDSCombinedCGMViewSQL);
}
}
Binary file not shown.
Binary file added pagefind/fragment/en_149f28a.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_20265ea.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_235cd67.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_24d36fb.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_25d2e2d.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_294fe0b.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_2b1255f.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_2bb1578.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_35139ef.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_3814cac.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_38e4748.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_393076f.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_3a49f67.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_4012b68.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_4195b99.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_41ccc9f.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_46429aa.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_4befc2a.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_4e82ca6.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_5012188.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_5088448.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_52b3b92.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_598450f.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_621257e.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_67269a1.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_6e75558.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_6f94863.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_701ac82.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_7061faf.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_72ca47d.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_78f0b58.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_7b6562f.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_7fedaf3.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_809fcfa.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_82d4e85.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_8466e41.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_935fcb5.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_93770d6.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_93bf52e.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_982454c.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_98c2c9a.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_9a0427b.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_9b765a8.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_9b91585.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_9c34aff.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_9d4a9ba.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_9eb3ce5.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_9ee95ef.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_a0e6b77.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_a3a7a8a.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_a9898ec.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_ada04e3.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file removed pagefind/fragment/en_af8b33f.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_afabd16.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_baf21f9.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_c273741.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_c58d963.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_cd28c4c.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_cefe7ec.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_d678e6c.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_dc8fa08.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_df8c459.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_e46fc8d.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_e86dc79.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_e956d6c.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_e97f75e.pf_fragment
Binary file not shown.
Binary file added pagefind/fragment/en_ed4258a.pf_fragment
Binary file not shown.
Binary file removed pagefind/fragment/en_ef6b59e.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_eff0ba7.pf_fragment
Binary file not shown.
Binary file not shown.
Binary file added pagefind/fragment/en_fa283f5.pf_fragment
Binary file not shown.
2 changes: 1 addition & 1 deletion pagefind/pagefind-entry.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.1.1","languages":{"en":{"hash":"en_3cc31ad778","wasm":"en","page_count":105}}}
{"version":"1.1.1","languages":{"en":{"hash":"en_96bc1bc92d","wasm":"en","page_count":105}}}
Binary file removed pagefind/pagefind.en_3cc31ad778.pf_meta
Binary file not shown.
Binary file added pagefind/pagefind.en_96bc1bc92d.pf_meta
Binary file not shown.
Loading

0 comments on commit dba9398

Please sign in to comment.