Skip to content

Commit

Permalink
Merge pull request #133 from coronasafe/sainak/fix/vitals
Browse files Browse the repository at this point in the history
Fix create operations and env booleans
  • Loading branch information
khavinshankar authored Jun 3, 2024
2 parents 808368f + 1f350e2 commit cc95994
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/cron/automatedDailyRounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export async function fileAutomatedDailyRound(
.catch((error: AxiosError) => error.response);

if (saveDailyRound) {
prisma.dailyRound.create({
await prisma.dailyRound.create({
data: {
assetExternalId: assetId,
status: response?.statusText ?? "FAILED",
Expand Down Expand Up @@ -366,7 +366,7 @@ export async function automatedDailyRounds() {
(weight! + 1)
: accuracy;

prisma.vitalsStat.create({
await prisma.vitalsStat.create({
data: {
imageId: _id,
vitalsFromImage: JSON.parse(JSON.stringify(vitals)),
Expand Down
19 changes: 9 additions & 10 deletions src/utils/configs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as dotenv from "dotenv";


dotenv.config();

export const nodeEnv = process.env.NODE_ENV ?? "development";
Expand All @@ -20,8 +19,10 @@ export const sentryTracesSampleRate = parseFloat(
process.env.SENTRY_SAMPLE_RATE ?? "0.01",
);

export const saveDailyRound = Boolean(process.env.SAVE_DAILY_ROUND ?? "true");
export const saveVitalsStat = Boolean(process.env.SAVE_VITALS_STAT ?? "true");
export const saveDailyRound =
(process.env.SAVE_DAILY_ROUND || "true") === "true";
export const saveVitalsStat =
(process.env.SAVE_VITALS_STAT || "true") === "true";

export const s3Provider = process.env.S3_PROVIDER ?? "AWS";
export const s3Endpoint =
Expand All @@ -34,16 +35,14 @@ export const s3BucketName = process.env.S3_BUCKET_NAME;
export const s3AccessKeyId = process.env.S3_ACCESS_KEY_ID;
export const s3SecretAccessKey = process.env.S3_SECRET_ACCESS_KEY;

export const s3DumpVitalsStat = Boolean(
process.env.S3_DUMP_VITALS_STAT ?? "false",
);
export const deleteVitalsStatOnDump = Boolean(
process.env.DELETE_VITALS_STAT_ON_DUMP ?? "false",
);
export const s3DumpVitalsStat =
(process.env.S3_DUMP_VITALS_STAT || "false") === "true";
export const deleteVitalsStatOnDump =
(process.env.DELETE_VITALS_STAT_ON_DUMP || "false") === "true";

export const openaiApiKey = process.env.OPENAI_API_KEY ?? "";
export const openaiEndpoint = process.env.OPENAI_ENDPOINT ?? "";
export const openaiApiVersion = process.env.OPENAI_API_VERSION ?? "2024-02-01";
export const openaiVisionModel =
process.env.OPENAI_VISION_MODEL ?? "vision-preview";
export const openaiUseAzure = openaiEndpoint.includes("azure.com");
export const openaiUseAzure = openaiEndpoint.includes("azure.com");
2 changes: 1 addition & 1 deletion src/utils/dailyRoundUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const getPatientId = async (assetExternalId: string) => {
// };

export const getBedById = async (bedId: string) => {
return prisma.bed.findFirst({
return await prisma.bed.findFirst({
where: {
externalId: bedId,
deleted: false,
Expand Down

0 comments on commit cc95994

Please sign in to comment.