Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

99 data product uploads #107

Closed
wants to merge 113 commits into from
Closed
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
b067ec9
WIP - handle blur in AutoComplete
ri-pandey Oct 30, 2023
4a14ed1
before fixing infinite loop due to validating caused by disabling button
ri-pandey Oct 31, 2023
1d5222a
disable going to next step if current step has errors
ri-pandey Oct 31, 2023
9c8123f
renamed file upload step name
ri-pandey Oct 31, 2023
0435911
WIP - UI - see todos - allow two-way sync b/w Stepper's and AutoCompl…
ri-pandey Nov 1, 2023
175cfff
Enhancements to Upload feature
ri-pandey Nov 2, 2023
16109a4
tested merging code locally
ri-pandey Nov 7, 2023
ca43727
moved <script/> below </template>
ri-pandey Nov 7, 2023
1a86c55
persist selected File Type in Stepper component
ri-pandey Nov 8, 2023
d45b562
merged New File Type and File Type Select into one component again
ri-pandey Nov 8, 2023
162f422
persist value of Raw Data select through v-model
ri-pandey Nov 8, 2023
4026beb
don't use .value in <template>
ri-pandey Nov 8, 2023
62d6956
fixed modal alert width
ri-pandey Nov 8, 2023
27e9a95
overwrite new File Type if it has already been created
ri-pandey Nov 8, 2023
09d989c
fixed vertical alignment for Raw Data select
ri-pandey Nov 8, 2023
a0ac9a4
renamed component
ri-pandey Nov 8, 2023
2c3c379
modified data model for tracking uploads
ri-pandey Nov 8, 2023
f52012a
created Data Product Uploads history page
ri-pandey Nov 8, 2023
f6fed4f
rolled back changes made to AutoComplete components
ri-pandey Nov 8, 2023
25ee2b2
changed scope
ri-pandey Nov 8, 2023
0fe0425
log Data Product and related metadata before beginning upload
ri-pandey Nov 10, 2023
101014f
fixed issues with persisting records
ri-pandey Nov 11, 2023
4cbfdb7
show details after submission
ri-pandey Nov 11, 2023
a7e0a8b
tested error handling
ri-pandey Nov 17, 2023
42d049f
testing
ri-pandey Nov 17, 2023
dd84d16
finished testing
ri-pandey Nov 18, 2023
0ef38ba
show file type as chips
ri-pandey Nov 18, 2023
dbd9f9f
WIP - resume upload
ri-pandey Nov 20, 2023
0ecfc3c
fixed checksum generation
ri-pandey Nov 20, 2023
5c1028d
re-tested script after refactoring
ri-pandey Nov 21, 2023
ae5c917
delete FAILED uploads after time threshold
ri-pandey Nov 21, 2023
9140b14
renamed file
ri-pandey Nov 21, 2023
ab7da4a
tested retry code
ri-pandey Nov 22, 2023
e68090d
testing
ri-pandey Nov 22, 2023
427f440
use isValid from useForm
ri-pandey Nov 27, 2023
c61f4fa
validate on button click; show warning before leaving
ri-pandey Nov 27, 2023
ebd4b36
show warning on leaving incomplete upload
ri-pandey Nov 28, 2023
c90707d
validate file's checksums post-merge
ri-pandey Nov 29, 2023
3a23712
Merge remote-tracking branch 'origin/main' into 99-data-product-uploads
ri-pandey Nov 29, 2023
c7135b1
moved all migrations into one file
ri-pandey Nov 29, 2023
e4ff1e7
cleanup
ri-pandey Nov 29, 2023
fbeea3b
added access-control
ri-pandey Nov 29, 2023
a254c9a
added cron schedule
ri-pandey Nov 29, 2023
3d05396
moved upload code to secure_download
ri-pandey Nov 30, 2023
92a49f9
reverted config change
ri-pandey Nov 30, 2023
da265c1
typo fix
ri-pandey Nov 30, 2023
e783703
update status as last step
ri-pandey Nov 30, 2023
47666ce
corrected status
ri-pandey Nov 30, 2023
c1e9889
allow script to fail
ri-pandey Dec 6, 2023
0281c66
Merge remote-tracking branch 'origin/main' into 99-data-product-uploads
ri-pandey Dec 10, 2023
d44b5fa
use crypto for checksum evaluation
ri-pandey Dec 11, 2023
0a9176d
use non-blocking method
ri-pandey Dec 11, 2023
1cd587b
use more descriptive status code
ri-pandey Dec 11, 2023
24707f2
changed status code
ri-pandey Dec 11, 2023
946cb7b
use more generic naming
ri-pandey Dec 11, 2023
0c652c8
renamed
ri-pandey Dec 13, 2023
5aa7cbb
refactoring
ri-pandey Dec 13, 2023
2ba94bd
changed var name
ri-pandey Dec 13, 2023
c114ad0
several minor changes
ri-pandey Dec 13, 2023
4257eb2
added docs for upload
ri-pandey Dec 13, 2023
85ef223
added comments
ri-pandey Dec 13, 2023
a998616
moved
ri-pandey Dec 13, 2023
3a46a6a
added docs
ri-pandey Dec 13, 2023
6ed585e
call upload API from UI
ri-pandey Dec 19, 2023
9983b93
updated arch diagram
ri-pandey Dec 19, 2023
f67b0f0
114 and 104 fixes (#148)
ri-pandey Feb 8, 2024
b2a10c3
fix accessiibility issues
deepakduggirala Feb 9, 2024
7c2fb87
fix project user select modal content width
deepakduggirala Feb 9, 2024
8b65624
fix some more accessibility issues
deepakduggirala Feb 9, 2024
952a191
Return workflows info with paginated datasets (#153)
ri-pandey Feb 9, 2024
7a72252
Merge branch 'dev' of github.com:IUSCA/bioloop into dev
deepakduggirala Feb 9, 2024
26c2f79
Merge remote-tracking branch 'origin/main' into dev
deepakduggirala Feb 9, 2024
08706b2
Merge remote-tracking branch 'origin/dev' into 99-data-product-uploads
ri-pandey Feb 13, 2024
a99f695
misc changes
ri-pandey Feb 13, 2024
c33642d
check for scope
Feb 13, 2024
372ada7
WIP - testing connection to secure_download
Feb 13, 2024
425dabe
Merge branch 'main' into dev
deepakduggirala Feb 16, 2024
959b8fd
add reset postgres script
deepakduggirala Feb 17, 2024
73e60b1
Merge branch 'main' into dev
deepakduggirala Feb 17, 2024
ac3da0c
146 inputs (#165)
ri-pandey Feb 19, 2024
42f2d5e
Merge branch 'dev-data-setup' into dev
deepakduggirala Feb 20, 2024
1aa4d5c
added debounce and loading (#160)
ri-pandey Feb 21, 2024
b34955b
Merge remote-tracking branch 'origin/dev' into 99-data-product-uploads
ri-pandey Feb 21, 2024
a95d881
use object instead of array
ri-pandey Feb 21, 2024
6c9450a
Merge remote-tracking branch 'refs/remotes/origin/99-data-product-upl…
ri-pandey Feb 21, 2024
aa0529b
fixed .env.example
ri-pandey Feb 21, 2024
280503f
use scope from env; log token
Feb 21, 2024
7d8898b
use provide/inject (#168)
ri-pandey Feb 21, 2024
e45648d
77 about page (#156)
ri-pandey Feb 23, 2024
c399dd9
cleanup (#171)
ri-pandey Feb 23, 2024
d11bb0e
Merge remote-tracking branch 'origin/dev' into 99-data-product-uploads
ri-pandey Feb 26, 2024
36e0cb7
WIP - token persistence
ri-pandey Feb 26, 2024
88d098b
refresh token
ri-pandey Mar 27, 2024
cd64465
nodemon
ri-pandey Mar 28, 2024
831d7b5
nodemon
ri-pandey Mar 28, 2024
a093a51
nodemon
ri-pandey Mar 28, 2024
aea4a9b
nodemon
ri-pandey Mar 28, 2024
17411ae
Merge remote-tracking branch 'origin/main' into 99-data-product-uploads
ri-pandey Mar 29, 2024
6fc1917
some minor refactoring
ri-pandey Mar 29, 2024
5cc3784
use v-models from store; WIP - write custom form validation method
ri-pandey Mar 29, 2024
6bd4aba
WIP - provide errors as props
ri-pandey Mar 29, 2024
2a41c79
WIP - validation in store
ri-pandey Mar 30, 2024
99af60f
bypass validation
ri-pandey Apr 1, 2024
875fe6c
migration
ri-pandey Apr 1, 2024
b920164
route
ri-pandey Apr 1, 2024
85d1205
fixed call
ri-pandey Apr 1, 2024
b71b798
logging
ri-pandey Apr 1, 2024
f2f38ee
logging
ri-pandey Apr 1, 2024
24bebd7
modified endpoints for test
ri-pandey Apr 1, 2024
f1f150c
logging
ri-pandey Apr 1, 2024
954d319
0
ri-pandey Apr 1, 2024
2799af0
test removals
ri-pandey Apr 1, 2024
7959375
WIP - maintain pristine state to show errors
ri-pandey Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions api/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
"client_id": "",
"client_secret": "",
"scope_prefix": "download_file:"
},
"upload": {
"client_id": "",
"client_secret": "",
"scope_prefix": "upload"
}
},
"download_server": {
Expand Down Expand Up @@ -82,7 +87,30 @@
"task": "delete_dataset"
}
]
},
"process_uploads": {
"steps": [
{
"name": "chunks_to_files",
"task": "chunks_to_files"
}
]
}
},
"dataset_types" : ["RAW_DATA", "DATA_PRODUCT"]
}
"dataset_types" : ["RAW_DATA", "DATA_PRODUCT"],
"DONE_STATUSES": {
"REVOKED": "REVOKED",
"FAILURE": "FAILURE",
"SUCCESS": "SUCCESS"
},
"upload_status": {
"UPLOADING": "UPLOADING",
"UPLOAD_FAILED": "UPLOAD_FAILED",
"UPLOADED": "UPLOADED",
"PROCESSING": "PROCESSING",
"COMPLETE": "COMPLETE",
"FAILED": "FAILED",
"VALIDATION_FAILED": "VALIDATION_FAILED"
},
"upload_path": "/opt/sca/data/uploads"
}
12 changes: 9 additions & 3 deletions api/package-lock.json

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

1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"lodash": "^4.17.21",
"morgan": "^1.10.0",
"multer": "1.4.5-lts.1",
"spark-md5": "^3.0.2",
"swagger-autogen": "^2.23.5",
"swagger-ui-express": "^5.0.0",
"winston": "^3.10.0"
Expand Down
58 changes: 58 additions & 0 deletions api/prisma/migrations/20231129205028_99_uploads/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
-- CreateEnum
CREATE TYPE "upload_status" AS ENUM ('UPLOADING', 'UPLOAD_FAILED', 'UPLOADED', 'PROCESSING', 'COMPLETE', 'VALIDATION_FAILED', 'FAILED');

-- AlterTable
ALTER TABLE "dataset" ADD COLUMN "file_type_id" INTEGER;

-- CreateTable
CREATE TABLE "upload_log" (
"id" SERIAL NOT NULL,
"status" "upload_status" NOT NULL,
"dataset_id" INTEGER,
"last_updated" TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"processing_attempt_count" INTEGER NOT NULL DEFAULT 0,
"user_id" INTEGER NOT NULL,

CONSTRAINT "upload_log_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "file_upload_log" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"md5" TEXT NOT NULL,
"num_chunks" INTEGER NOT NULL,
"status" "upload_status" NOT NULL,
"chunks_path" TEXT NOT NULL,
"destination_path" TEXT NOT NULL,
"upload_log_id" INTEGER,

CONSTRAINT "file_upload_log_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "dataset_file_type" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"extension" TEXT NOT NULL,

CONSTRAINT "dataset_file_type_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "upload_log_dataset_id_key" ON "upload_log"("dataset_id");

-- CreateIndex
CREATE UNIQUE INDEX "dataset_file_type_name_extension_key" ON "dataset_file_type"("name", "extension");

-- AddForeignKey
ALTER TABLE "dataset" ADD CONSTRAINT "dataset_file_type_id_fkey" FOREIGN KEY ("file_type_id") REFERENCES "dataset_file_type"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "upload_log" ADD CONSTRAINT "upload_log_dataset_id_fkey" FOREIGN KEY ("dataset_id") REFERENCES "dataset"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "upload_log" ADD CONSTRAINT "upload_log_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "file_upload_log" ADD CONSTRAINT "file_upload_log_upload_log_id_fkey" FOREIGN KEY ("upload_log_id") REFERENCES "upload_log"("id") ON DELETE SET NULL ON UPDATE CASCADE;
123 changes: 86 additions & 37 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ model dataset {
id Int @id @default(autoincrement())
name String
type String
file_type dataset_file_type? @relation(fields: [file_type_id], references: [id])
file_type_id Int?
num_directories Int?
num_files Int?
du_size BigInt?
Expand All @@ -34,9 +36,44 @@ model dataset {
projects project_dataset[]
accesses data_access_log[]
stage_requests stage_request_log[]
upload_log upload_log?

@@unique([name, type, is_deleted])
}

model upload_log {
id Int @id @default(autoincrement())
status upload_status
dataset_id Int? @unique
dataset dataset? @relation(fields: [dataset_id], references: [id])
files file_upload_log[]
last_updated DateTime @default(now()) @db.Timestamp(6)
processing_attempt_count Int @default(0)
user_id Int
user user @relation(fields: [user_id], references: [id])
}

model file_upload_log {
id Int @id @default(autoincrement())
name String
md5 String
num_chunks Int
status upload_status
chunks_path String
destination_path String
upload_log upload_log? @relation(fields: [upload_log_id], references: [id])
upload_log_id Int?
}

model dataset_file_type {
id Int @id @default(autoincrement())
name String
extension String
datasets dataset[]

@@unique([name, extension])
}

model dataset_hierarchy {
source_id Int
derived_id Int
Expand All @@ -48,19 +85,20 @@ model dataset_hierarchy {
}

model dataset_file {
id Int @id @default(autoincrement())
name String?
path String
md5 String?
size BigInt?
filetype String?
metadata Json?
status String?
dataset_id Int
dataset dataset @relation(fields: [dataset_id], references: [id], onDelete: Cascade)
parents dataset_file_hierarchy[] @relation("child")
children dataset_file_hierarchy[] @relation("parent")
accesses data_access_log[]
id Int @id @default(autoincrement())
name String?
path String
md5 String?
size BigInt?
filetype String?
metadata Json?
status String?
dataset_id Int
dataset dataset @relation(fields: [dataset_id], references: [id], onDelete: Cascade)
parents dataset_file_hierarchy[] @relation("child")
children dataset_file_hierarchy[] @relation("parent")
accesses data_access_log[]

@@unique([path, dataset_id])
@@index([dataset_id])
}
Expand Down Expand Up @@ -97,36 +135,36 @@ model dataset_state {
}

model data_access_log {
id Int @id @default(autoincrement())
timestamp DateTime @default(now()) @db.Timestamp(6)
access_type access_type
file_id Int?
dataset_file dataset_file? @relation(fields: [file_id], references: [id])
dataset_id Int?
dataset dataset? @relation(fields: [dataset_id], references: [id])
user_id Int
user user @relation(fields: [user_id], references: [id])
id Int @id @default(autoincrement())
timestamp DateTime @default(now()) @db.Timestamp(6)
access_type access_type
file_id Int?
dataset_file dataset_file? @relation(fields: [file_id], references: [id])
dataset_id Int?
dataset dataset? @relation(fields: [dataset_id], references: [id])
user_id Int
user user @relation(fields: [user_id], references: [id])
}

model stage_request_log {
id Int @id @default(autoincrement())
timestamp DateTime @default(now()) @db.Timestamp(6)
dataset_id Int?
dataset dataset? @relation(fields: [dataset_id], references: [id])
user_id Int
user user @relation(fields: [user_id], references: [id])
id Int @id @default(autoincrement())
timestamp DateTime @default(now()) @db.Timestamp(6)
dataset_id Int?
dataset dataset? @relation(fields: [dataset_id], references: [id])
user_id Int
user user @relation(fields: [user_id], references: [id])
}

model user {
id Int @id @default(autoincrement())
username String @unique @db.VarChar(100)
name String? @db.VarChar(100)
email String @unique @db.VarChar(100)
cas_id String? @unique @db.VarChar(100)
id Int @id @default(autoincrement())
username String @unique @db.VarChar(100)
name String? @db.VarChar(100)
email String @unique @db.VarChar(100)
cas_id String? @unique @db.VarChar(100)
notes String?
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
is_deleted Boolean @default(false)
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
is_deleted Boolean @default(false)
user_role user_role[]
settings user_settings?
contacts contact[]
Expand All @@ -136,6 +174,7 @@ model user {
login user_login?
accesses data_access_log[]
stage_requests stage_request_log[]
uploads upload_log[]
}

model user_password {
Expand Down Expand Up @@ -280,4 +319,14 @@ model worker_process {
enum access_type {
BROWSER
SLATE_SCRATCH
}
}

enum upload_status {
UPLOADING
UPLOAD_FAILED
UPLOADED
PROCESSING
COMPLETE
VALIDATION_FAILED
FAILED
}
25 changes: 25 additions & 0 deletions api/prisma/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ async function main() {

await Promise.all(operator_promises);

// create dataset_file_type
await prisma.dataset_file_type.deleteMany();
await prisma.dataset_file_type.createMany({ data: data.dataset_file_types });

// create datasets
const datasetPromises = data.datasets.map((dataset) => {
const { workflows, ...dataset_obj } = dataset;
if (workflows) {
Expand Down Expand Up @@ -281,6 +286,26 @@ async function main() {
await prisma.stage_request_log.createMany({
data: stage_request_logs,
});

// create data upload entries
const dataset_uploads = data.data_product_upload_logs;
const operators = await prisma.user.findMany({
where: {
user_role: {
some: {
role_id: 2,
},
},
},
});
const uploads = dataset_uploads.map((e) => {
const operator = operators[Math.floor(Math.random() * operators.length)];
return { ...e, user_id: operator.id };
});
await prisma.upload_log.deleteMany();
await prisma.upload_log.createMany({
data: uploads,
});
}

main()
Expand Down
Loading