Skip to content

Commit

Permalink
Merge pull request #138 from coronasafe/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg authored Jun 24, 2024
2 parents c788e06 + cb67248 commit c32a8df
Show file tree
Hide file tree
Showing 32 changed files with 639 additions and 346 deletions.
158 changes: 7 additions & 151 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"morgan": "^1.10.0",
"node-cron": "^3.0.3",
"onvif": "^0.6.5",
"openai": "^4.33.1",
"openai": "^4.47.2",
"pidusage": "^3.0.0",
"sharp": "^0.33.3",
"swagger-jsdoc": "^6.1.0",
"swagger-ui-express": "^4.3.0",
"uuid": "^9.0.1"
},
"scripts": {
"copy-assets": "node tools/copyAssets.js",
"copy-assets": "cp -r src/views src/public dist/.",
"build": "prisma generate && tsc && tsc-alias && npm run copy-assets",
"dev": "nodemon",
"debug": "nodemon --inspect",
Expand Down Expand Up @@ -76,7 +76,6 @@
"nodemon": "^2.0.19",
"prettier": "^3.2.5",
"prisma": "^5.9.1",
"shelljs": "^0.8.5",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.8",
"tsconfig-paths": "^4.2.0",
Expand All @@ -86,4 +85,4 @@
"engines": {
"node": ">=20.0.0"
}
}
}
14 changes: 14 additions & 0 deletions prisma/migrations/20240530063454_add_stats_vital/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- CreateTable
CREATE TABLE "VitalsStat" (
"id" SERIAL NOT NULL,
"imageId" TEXT NOT NULL,
"vitalsFromObservation" JSONB NOT NULL,
"vitalsFromImage" JSONB NOT NULL,
"gptDetails" JSONB NOT NULL,
"accuracy" DOUBLE PRECISION NOT NULL,
"cumulativeAccuracy" DOUBLE PRECISION NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "VitalsStat_pkey" PRIMARY KEY ("id")
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Rename the existing column to a temporary name
ALTER TABLE "VitalsStat" RENAME COLUMN "accuracy" TO "accuracy_temp";
ALTER TABLE "VitalsStat" RENAME COLUMN "cumulativeAccuracy" TO "cumulativeAccuracy_temp";

-- Add the new column with the Json type
ALTER TABLE "VitalsStat" ADD COLUMN "accuracy" Json;
ALTER TABLE "VitalsStat" ADD COLUMN "cumulativeAccuracy" Json;

-- Copy the data from the old column to the new column, converting floats to JSON
UPDATE "VitalsStat" SET "accuracy" = json_build_object('overall', "accuracy_temp", 'metrics', '[]'::json);
UPDATE "VitalsStat" SET "cumulativeAccuracy" = json_build_object('overall', "cumulativeAccuracy_temp", 'metrics', '[]'::json);

-- Drop the temporary column
ALTER TABLE "VitalsStat" DROP COLUMN "accuracy_temp";
ALTER TABLE "VitalsStat" DROP COLUMN "cumulativeAccuracy_temp";

12 changes: 12 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,15 @@ model DailyRound {
time DateTime @default(now())
asset Asset @relation(fields: [assetExternalId], references: [externalId], onDelete: Cascade, onUpdate: Cascade)
}

model VitalsStat {
id Int @id @default(autoincrement())
imageId String
vitalsFromObservation Json
vitalsFromImage Json
gptDetails Json
accuracy Json
cumulativeAccuracy Json
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Loading

0 comments on commit c32a8df

Please sign in to comment.