Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed Apr 15, 2024
1 parent 76f8b8f commit ee04eec
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
11 changes: 6 additions & 5 deletions src/cron/automatedDailyRounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import FormData from "form-data";
import fs from "fs";
import path from "path";



import { staticObservations } from "@/controller/ObservationController";
import prisma from "@/lib/prisma";
import { DailyRoundObservation, Observation, ObservationType } from "@/types/observation";
import {
DailyRoundObservation,
Observation,
ObservationType,
} from "@/types/observation";
import { CameraUtils } from "@/utils/CameraUtils";
import { isValid } from "@/utils/ObservationUtils";
import { generateHeaders } from "@/utils/assetUtils";
import { careApi, ocrApi, saveDailyRound } from "@/utils/configs";
import { getPatientId } from "@/utils/dailyRoundUtils";
import { downloadImage } from "@/utils/downloadImageWithDigestRouter";


const UPDATE_INTERVAL = 60 * 60 * 1000;

type CarePaginatedResponse<T> = {
Expand Down Expand Up @@ -457,4 +458,4 @@ export async function automatedDailyRounds() {
await fileAutomatedDailyRound(consultation_id, monitor.externalId, vitals);
console.log(`Daily round filed for the patient ${patient_id}`);
});
}
}
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import * as cron from "node-cron";



import { automatedDailyRounds } from "@/cron/automatedDailyRounds";
import { initServer } from "@/server";
import { port } from "@/utils/configs";
import { retrieveAssetConfig } from "@/utils/retrieveAssetConfig";


process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE = "1";
process.env.CHECKPOINT_DISABLE = "1";

Expand All @@ -29,4 +26,4 @@ process.env.CHECKPOINT_DISABLE = "1";
`[SERVER] : Middleware App listening at http://localhost:${port}`,
),
);
})();
})();
3 changes: 1 addition & 2 deletions src/utils/CameraUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as onvif from "onvif";


const Cam = onvif.Cam;

const cameraLock = {};
Expand Down Expand Up @@ -129,4 +128,4 @@ export class CameraUtils {
}
});
});
}
}
7 changes: 6 additions & 1 deletion src/utils/ObservationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ export const messages = [
];

export const isValid = (observation: Observation) => {
if (!observation || !observation.status || (!["blood-pressure"].includes(observation.observation_id) && isNaN(observation.value ?? NaN))) {
if (
!observation ||
!observation.status ||
(!["blood-pressure"].includes(observation.observation_id) &&
isNaN(observation.value ?? NaN))
) {
return false;
}

Expand Down
11 changes: 8 additions & 3 deletions src/utils/dailyRoundUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ export const getAsset = async (assetIp: string) => {

export const getPatientId = async (assetExternalId: string) => {
return await axios
.get(`${careApi}/api/v1/consultation/patient_from_asset/?preset_name=monitor`, {
headers: (await generateHeaders(assetExternalId)) as AxiosRequestHeaders,
})
.get(
`${careApi}/api/v1/consultation/patient_from_asset/?preset_name=monitor`,
{
headers: (await generateHeaders(
assetExternalId,
)) as AxiosRequestHeaders,
},
)
.then((res) => res.data)
.catch((err) => {
console.log(
Expand Down

0 comments on commit ee04eec

Please sign in to comment.