Skip to content

Commit

Permalink
Merge pull request #101 from coronasafe/wait-ocr
Browse files Browse the repository at this point in the history
made ocr capture wait time as env
  • Loading branch information
mathew-alex authored Sep 27, 2023
2 parents 9a2f611 + a0b6555 commit bd81ca2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/automation/autoDataExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import FormData from 'form-data';
import { getMonitorCoordinates } from "./helper/getMonitorCoordinates.js";

import * as dotenv from "dotenv";
import { saveOCRImages } from "../utils/configs.js";
import { saveOCRImages, waitBeforeOCRCapture } from "../utils/configs.js";

dotenv.config({ path: "./.env" });

Expand All @@ -32,7 +32,7 @@ const validator = (value, parser, minvalue, maxValue) => {
return value >= minvalue && value <= maxValue ? value : null;
};
const getSanitizedData = (data) => {
console.log(data);
console.log("Data from OCR: ", data);

const sanitizedData = {};
sanitizedData["spo2"] = !isNaN(data?.["SpO2"])
Expand Down Expand Up @@ -78,7 +78,9 @@ const extractData = async (camParams, monitorPreset = { x: 0, y: 0, z: 0 }) => {
await CameraUtils.absoluteMove({ camParams, ...monitorPreset });

// TODO: replace timeout with a better solution
await new Promise((resolve) => setTimeout(resolve, 10 * 1000));
await new Promise((resolve) =>
setTimeout(resolve, waitBeforeOCRCapture * 1000)
);

const snapshotUrl = await CameraUtils.getSnapshotUri({ camParams });

Expand Down
4 changes: 3 additions & 1 deletion src/utils/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ 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 saveOCRImages = process.env.SAVE_OCR_IMAGES === "true";
export const saveOCRImages = process.env.SAVE_OCR_IMAGES === "true";
export const waitBeforeOCRCapture =
parseInt(process.env.WAIT_BEFORE_OCR_CAPTURE) || 0;

0 comments on commit bd81ca2

Please sign in to comment.