Skip to content

Commit

Permalink
Feature/uni 296 scraper (#327)
Browse files Browse the repository at this point in the history
* updated schema and scraper to automatically format in 18S1 or 19T2

* made routes and code to push studentVIP to database

* commit to change branch

* made changes to git ignore to ignore scraped data

* feat: upgrade migration node to 20.4, fixed migration upsert query to remove duplicate columns

* added the functions to get studentVIP reviews into the service

* made routess for studentVIP revieww

* bugfix: revert review/courseID return statement

* started adding routes for uninotes

* added backend routes for studentvip

* correction: previous commit is adding routes for uniNotes

* updated seed to insert uninotes reviews

* added table alias for scrapped reviews to conform to postgres rules

* added scrapped review schema migration and successfully seeded

* course page changes (might be broken)

* readded new review schema migration

* fix tom's code, updated scrapped reviews schema to use 'reviews' as key in return data

* added timestamp to scraped review backend schema & move its date creation to db

* refactor backend to merge scraped schemas

* merged studentvip and uninotes on frontend

* changed sql query for get all courses to join scraped reviews table

* changed all get course query to join scraped reviews table

* upvotes and bookmarks

* Updated the scraper python files to create sql files instead of json

* fixed bookmark service and added all reviews schema in backend

* fixed scraping insert statement

* added scraped review id increment

---------

Co-authored-by: Bob Chen <[email protected]>
Co-authored-by: Jared L <[email protected]>
Co-authored-by: Dylan W <[email protected]>
Co-authored-by: 3syth <[email protected]>
Co-authored-by: Adrian Balbalosa <[email protected]>
Co-authored-by: ur-ja <[email protected]>
Co-authored-by: Maximilian Falco Widjaya <[email protected]>
Co-authored-by: Tom Forsyth <[email protected]>
Co-authored-by: Kevin Sutandi <[email protected]>
Co-authored-by: dylan <birds@DylanW-PC>
Co-authored-by: Kevin Sutandi <[email protected]>
Co-authored-by: Dylan <[email protected]>
Co-authored-by: Maximilian Falco Widjaya <[email protected]>
  • Loading branch information
14 people authored Nov 4, 2024
1 parent aa5ec7a commit 4ca2b43
Show file tree
Hide file tree
Showing 25 changed files with 761 additions and 92 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ tmp/
temp/
dist/
coverage/
.DS_Store
.DS_Store
data/
177 changes: 165 additions & 12 deletions backend/package-lock.json

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

11 changes: 8 additions & 3 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
"format": "prettier '**/*.ts' --write",
"build": "tsc",
"start": "npx prisma migrate deploy && node dist/src/index.js",
"dev": "NODE_ENV=dev tsx src/index.ts",
"dev": "NODE_ENV=dev & tsx src/index.ts",
"dev:watch": "NODE_ENV=dev tsx watch src/index.ts",
"test": "jest --coverage --verbose"
},
"prisma": {
"seed": "ts-node prisma/seed.ts"
},
"dependencies": {
"@prisma/client": "^5.0.0",
"cors": "^2.8.5",
"envsafe": "^2.0.3",
"express": "^4.18.2",
"fs": "^0.0.1-security",
"ioredis": "^5.3.2",
"jsonwebtoken": "^9.0.1",
"node-fetch": "^3.3.2",
Expand All @@ -30,7 +34,7 @@
"@types/express": "4.17.17",
"@types/jest": "29.5.3",
"@types/jsonwebtoken": "9.0.2",
"@types/node": "20.4.2",
"@types/node": "^20.14.10",
"@types/swagger-ui-express": "^4.1.3",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
Expand All @@ -41,7 +45,8 @@
"prettier": "3.2.5",
"prisma": "^5.0.0",
"ts-jest": "29.1.1",
"ts-node": "^10.9.2",
"tsx": "^3.12.7",
"typescript": "^5.1.6"
"typescript": "^5.5.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "reviews_scraped" (
"review_scraped_id" UUID NOT NULL DEFAULT gen_random_uuid(),
"source" TEXT NOT NULL,
"source_id" INTEGER NOT NULL,
"course_code" TEXT NOT NULL,
"author_name" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"term_taken" TEXT NOT NULL,
"created_timestamp" TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"upvotes" TEXT[],
"overall_rating" DOUBLE PRECISION NOT NULL,

CONSTRAINT "pk_review_scraped_id" PRIMARY KEY ("review_scraped_id")
);

-- AddForeignKey
ALTER TABLE "reviews_scraped" ADD CONSTRAINT "fk_course_code" FOREIGN KEY ("course_code") REFERENCES "courses"("course_code") ON DELETE NO ACTION ON UPDATE NO ACTION;
3 changes: 3 additions & 0 deletions backend/prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"
Loading

0 comments on commit 4ca2b43

Please sign in to comment.