Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 10, 2024
1 parent 69eae3b commit 8ede375
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
46 changes: 23 additions & 23 deletions query-connector/src/app/database-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const executeDefaultQueryCreation = async () => {
console.log("Executing default query linking script");
await dbClient.query(insertDefaultQueryLogicSql);
console.log(
"Default queries, queries to conditions, and query included concepts insertion complete"
"Default queries, queries to conditions, and query included concepts insertion complete",
);
} catch (error) {
console.error("Could not cross-index default queries", error);
Expand Down Expand Up @@ -169,7 +169,7 @@ type ErsdOrVsacResponse = Bundle | Parameters | OperationOutcome;
* @returns The eRSD Specification as a FHIR Bundle or an OperationOutcome if an error occurs.
*/
export async function getERSD(
eRSDVersion: number = 3
eRSDVersion: number = 3,
): Promise<ErsdOrVsacResponse> {
const ERSD_API_KEY = process.env.ERSD_API_KEY;
const eRSDUrl = `https://ersd.aimsplatform.org/api/ersd/v${eRSDVersion}specification?format=json&api-key=${ERSD_API_KEY}`;
Expand Down Expand Up @@ -205,7 +205,7 @@ export async function getERSD(
export async function getVSACValueSet(
oid: string,
searchStructType: string = "valueset",
codeSystem?: string
codeSystem?: string,
): Promise<ErsdOrVsacResponse> {
const username: string = "apikey";
const umlsKey: string = process.env.UMLS_API_KEY || "";
Expand Down Expand Up @@ -248,7 +248,7 @@ export async function getVSACValueSet(
*/
export async function translateVSACToInternalValueSet(
fhirValueset: FhirValueSet,
ersdConceptType: ErsdConceptType
ersdConceptType: ErsdConceptType,
) {
const oid = fhirValueset.id;
const version = fhirValueset.version;
Expand Down Expand Up @@ -289,19 +289,19 @@ export async function insertValueSet(vs: ValueSet) {
await insertValueSetPromise;
} catch (e) {
console.error(
`ValueSet insertion for ${vs.valueSetId}_${vs.valueSetVersion} failed`
`ValueSet insertion for ${vs.valueSetId}_${vs.valueSetVersion} failed`,
);
console.error(e);
errorArray.push("Error occured in valuset insertion");
}

const insertConceptsPromiseArray = generateConceptSqlPromises(vs);
const conceptInsertResults = await Promise.allSettled(
insertConceptsPromiseArray
insertConceptsPromiseArray,
);

const allConceptInsertsSucceed = conceptInsertResults.every(
(r) => r.status === "fulfilled"
(r) => r.status === "fulfilled",
);

if (!allConceptInsertsSucceed) {
Expand All @@ -313,13 +313,13 @@ export async function insertValueSet(vs: ValueSet) {
const joinInsertResults = await Promise.allSettled(joinInsertsPromiseArray);

const allJoinInsertsSucceed = joinInsertResults.every(
(r) => r.status === "fulfilled"
(r) => r.status === "fulfilled",
);

if (!allJoinInsertsSucceed) {
logRejectedPromiseReasons(
joinInsertResults,
"ValueSet <> concept join insert failed"
"ValueSet <> concept join insert failed",
);
errorArray.push("Error occured in ValueSet <> concept join seeding");
}
Expand Down Expand Up @@ -415,7 +415,7 @@ function stripProtocolAndTLDFromSystemUrl(systemURL: string) {

function logRejectedPromiseReasons<T>(
resultsArray: PromiseSettledResult<T>[],
errorMessageString: string
errorMessageString: string,
) {
return resultsArray
.filter((r): r is PromiseRejectedResult => r.status === "rejected")
Expand All @@ -442,7 +442,7 @@ export async function insertQuery(input: QueryInput) {
queryId = results.rows[0].id as unknown as UUID;
} catch (e) {
console.error(
`Error occured in user query insertion: insertion for ${input.queryName} failed`
`Error occured in user query insertion: insertion for ${input.queryName} failed`,
);
console.error(e);
errorArray.push("Error occured in user query insertion");
Expand All @@ -452,7 +452,7 @@ export async function insertQuery(input: QueryInput) {

const insertJoinSqlArray = generateQueryToValueSetInsertionSql(
input,
queryId as UUID
queryId as UUID,
);

const joinPromises = insertJoinSqlArray.map((q) => {
Expand All @@ -462,7 +462,7 @@ export async function insertQuery(input: QueryInput) {
const joinInsertResults = await Promise.allSettled(joinPromises);

const joinInsertsSucceeded = joinInsertResults.every(
(r) => r.status === "fulfilled"
(r) => r.status === "fulfilled",
);

if (!joinInsertsSucceeded) {
Expand Down Expand Up @@ -504,7 +504,7 @@ export async function checkValueSetInsertion(vs: ValueSet) {
foundVS.author !== vs.author
) {
console.error(
"Retrieved value set information differs from given value set"
"Retrieved value set information differs from given value set",
);
missingData.missingValueSet = true;
}
Expand Down Expand Up @@ -532,18 +532,18 @@ export async function checkValueSetInsertion(vs: ValueSet) {
console.error(
"Retrieved concept " +
conceptId +
" has different values than given concept"
" has different values than given concept",
);
return conceptId;
}
} catch (error) {
console.error(
"Couldn't fetch concept with ID " + conceptId + ": ",
error
error,
);
return conceptId;
}
})
}),
);
missingData.missingConcepts = brokenConcepts.filter((bc) => bc !== undefined);

Expand All @@ -560,18 +560,18 @@ export async function checkValueSetInsertion(vs: ValueSet) {
const fIdx = rows.findIndex((r) => r["concept_id"] === conceptUniqueId);
if (fIdx === -1) {
console.error(
"Couldn't locate concept " + conceptUniqueId + " in fetched mappings"
"Couldn't locate concept " + conceptUniqueId + " in fetched mappings",
);
return conceptUniqueId;
}
});
missingData.missingMappings = missingConceptsFromMappings.filter(
(item) => item !== undefined
(item) => item !== undefined,
);
} catch (error) {
console.error(
"Couldn't fetch value set to concept mappings for this valueset: ",
error
error,
);
const systemPrefix = stripProtocolAndTLDFromSystemUrl(vs.system);
vs.concepts.forEach((c) => {
Expand Down Expand Up @@ -609,7 +609,7 @@ export async function getConditionsData() {
acc[category].push({ [id]: name });
return acc;
},
{} as CategoryToConditionArrayMap
{} as CategoryToConditionArrayMap,
);

// 2. ID-Name mapping
Expand All @@ -631,7 +631,7 @@ export async function getConditionsData() {
*/
export async function insertDBStructArray(
structs: dbInsertStruct[],
insertType: string
insertType: string,
) {
const allStructPromises = structs.map((struct) => {
let structInsertSql: string = "";
Expand Down Expand Up @@ -803,7 +803,7 @@ export async function getCustomQueries(): Promise<CustomUserQuery[]> {

// Check if the valueSetId already exists in the valuesets array
let valueset = formattedData[query_id].valuesets.find(
(v) => v.valueSetId === valueSetId
(v) => v.valueSetId === valueSetId,
);

// If valueSetId doesn't exist, add it
Expand Down
2 changes: 1 addition & 1 deletion query-connector/src/app/query/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Query: React.FC = () => {
const [mode, setMode] = useState<Mode>("search");
const [loading, setLoading] = useState<boolean>(false);
const [fhirServer, setFhirServer] = useState<FHIR_SERVERS>(
DEFAULT_DEMO_FHIR_SERVER
DEFAULT_DEMO_FHIR_SERVER,
);
const [fhirServers, setFhirServers] = useState<string[]>([]);

Expand Down

0 comments on commit 8ede375

Please sign in to comment.