Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhao99 committed Oct 23, 2024
1 parent 85c3561 commit a59ad54
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions query-connector/src/app/database-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,9 @@ export async function translateVSACToInternalValueSet(
}

/**
*
* @param vs
* Function call to insert a new ValueSet into the database.
* @param vs - a ValueSet in of the shape of our internal data model to insert
* @returns success / failure information, as well as errors as appropriate
*/
export async function insertValueSet(vs: ValueSet) {
const insertValueSetSql = generateValueSetSqlStatement(vs);
Expand All @@ -234,13 +235,24 @@ export async function insertValueSet(vs: ValueSet) {
return { success: false, error: failedInserts };
}

/**
* Helper function to generate the SQL needed for valueset insertion.
* @param vs - The ValueSet in of the shape of our internal data model to insert
* @returns The SQL statement for insertion
*/
function generateValueSetSqlStatement(vs: ValueSet) {
const valueSetOid = vs.valueSetId;
const valueSetUniqueId = `${valueSetOid}_${vs.valueSetVersion}`;
const insertValueSetSql = `INSERT INTO valuesets VALUES('${valueSetUniqueId}','${valueSetOid}','${vs.valueSetVersion}','${vs.valueSetName}','${vs.author}','${vs.ersdConceptType}');`;
return insertValueSetSql;
}

/**
* Helper function to generate the SQL needed for concept / valueset join insertion
* needed during valueset creation.
* @param vs - The ValueSet in of the shape of our internal data model to insert
* @returns The SQL statement array for all concepts for insertion
*/
function generateConceptSqlStatements(vs: ValueSet) {
const valueSetOid = vs.valueSetId;
const valueSetUniqueId = `${valueSetOid}_${vs.valueSetVersion}`;
Expand Down

0 comments on commit a59ad54

Please sign in to comment.