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

Add standalone CPEx scraper #3622

Merged
merged 13 commits into from
Oct 8, 2023
Merged

Add standalone CPEx scraper #3622

merged 13 commits into from
Oct 8, 2023

Conversation

chrisgzf
Copy link
Member

@chrisgzf chrisgzf commented Oct 1, 2023

Context

This PR adds the standalone MPE scraper I've started using since MPE from the last semester.

Why is this needed?

Prior to 2310 MPE, the MPE scraper was coupled with the NUSMods scraper's acad year.

Meaning, in AY2022/2023 S1, when the NUSMods scraper is set to AY2022/2023 S1, we can scrape MPE data for AY2022/2023 S2, which works fine.

However, in AY2022/2023 S2, when the NUSMods scraper is set to AY2022/2023 S2, we cannot scrape MPE data for AY2023/2024 S1, because it is a different acad year. We could just run a separate instance of the NUSMods scraper for AY2023/2024 yes, but because the module data for AY2023/2024 will not be ready by then, the scraper (where we built in a lot of validation) will error out.

The solution, is hence, to build a very simple, standalone MPE scraper, that is not coupled with the NUSMods scraper.

Note: this is definitely not the cleanest, but it's simple, it works, and it does its job well.

@chrisgzf chrisgzf requested a review from a team October 1, 2023 11:15
@vercel
Copy link

vercel bot commented Oct 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2023 5:32am
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2023 5:32am

@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (7312bf0) 53.24% compared to head (c63f1f5) 53.24%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3622   +/-   ##
=======================================
  Coverage   53.24%   53.24%           
=======================================
  Files         271      271           
  Lines        5862     5862           
  Branches     1396     1396           
=======================================
  Hits         3121     3121           
  Misses       2741     2741           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ravern ravern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM!

@ravern ravern changed the title Add standalone MPE scraper Add standalone CPEx scraper Oct 8, 2023
@ravern
Copy link
Member

ravern commented Oct 8, 2023

This doesn't

  1. Remove the old MPE scraper, which should still produce mpeModules.json in the semester-level directory
  2. Modify the frontend to use the new cpexModules.json file

@ravern ravern deleted the standalone-mpe-scraper branch October 8, 2023 07:12
Copy link
Member Author

@chrisgzf chrisgzf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes

import fs from 'fs';
import path from 'path';

import env from '../env.json';

// Configure this!
const term = '2310';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to set this to 2320

alissayarmantho added a commit that referenced this pull request Oct 8, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho added a commit that referenced this pull request Oct 8, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

* Change package.json to use openssl legacy (#3623)

Change package.json to set env variable(#3623)

* Remove nodeoptions from package.json and change mpe api link (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho pushed a commit to alissayarmantho/nusmods that referenced this pull request Oct 8, 2023
alissayarmantho added a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
…fications#3632)

* chore(deps): update dependency postcss to v8.4.31 [security] (nusmodifications#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (nusmodifications#3622)

* chore(cpex): set term to next term instead of current (nusmodifications#3631)

* Change MPE to CPE and Open MPE (nusmodifications#3623)

* Fix serverless function not working (nusmodifications#3623)

* Change modules to courses (nusmodifications#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (nusmodifications#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho added a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (nusmodifications#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (nusmodifications#3622)

* chore(cpex): set term to next term instead of current (nusmodifications#3631)

* Change MPE to CPE and Open MPE (nusmodifications#3623)

* Fix serverless function not working (nusmodifications#3623)

* Change modules to courses (nusmodifications#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (nusmodifications#3623)

* Change package.json to use openssl legacy (nusmodifications#3623)

Change package.json to set env variable(nusmodifications#3623)

* Remove nodeoptions from package.json and change mpe api link (nusmodifications#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho pushed a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
alissayarmantho pushed a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
alissayarmantho added a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
…fications#3632)

* chore(deps): update dependency postcss to v8.4.31 [security] (nusmodifications#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (nusmodifications#3622)

* chore(cpex): set term to next term instead of current (nusmodifications#3631)

* Change MPE to CPE and Open MPE (nusmodifications#3623)

* Fix serverless function not working (nusmodifications#3623)

* Change modules to courses (nusmodifications#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (nusmodifications#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho added a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (nusmodifications#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (nusmodifications#3622)

* chore(cpex): set term to next term instead of current (nusmodifications#3631)

* Change MPE to CPE and Open MPE (nusmodifications#3623)

* Fix serverless function not working (nusmodifications#3623)

* Change modules to courses (nusmodifications#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (nusmodifications#3623)

* Change package.json to use openssl legacy (nusmodifications#3623)

Change package.json to set env variable(nusmodifications#3623)

* Remove nodeoptions from package.json and change mpe api link (nusmodifications#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho pushed a commit to alissayarmantho/nusmods that referenced this pull request Oct 14, 2023
alissayarmantho added a commit that referenced this pull request Oct 14, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho added a commit that referenced this pull request Oct 14, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

* Change package.json to use openssl legacy (#3623)

Change package.json to set env variable(#3623)

* Remove nodeoptions from package.json and change mpe api link (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
chrisgzf added a commit that referenced this pull request Oct 14, 2023
* Change MPE to CPE and Open MPE (#3623) (#3627)

Prepare for CPEx open

* Fix serverless function error 500 in vercel (#3623) (#3628)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623) (#3629)

* Change modules to courses (#3623)

* Change inS1 and inS2 MPE to CPEx and fix private key parsing (#3632)

* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>

* Update nus-auth.ts (#3623)

Remove previous changes

* Try to fix openssl legacy error (#3623)

* chore(deps): update dependency postcss to v8.4.31 [security] (#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (#3622)

* chore(cpex): set term to next term instead of current (#3631)

* Change MPE to CPE and Open MPE (#3623)

* Fix serverless function not working (#3623)

* Change modules to courses (#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (#3623)

* Change package.json to use openssl legacy (#3623)

Change package.json to set env variable(#3623)

* Remove nodeoptions from package.json and change mpe api link (#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>

* Update ModuleForm.tsx to use CPEx (#3623)

* Update FAQ to point to CPEx FAQ (#3623)

* Regenerate yarn lockfile using yarn classic v1

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho added a commit to alissayarmantho/nusmods that referenced this pull request Oct 21, 2023
* chore(deps): update dependency postcss to v8.4.31 [security] (nusmodifications#3630)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* feat(cpex): add standalone scraper (nusmodifications#3622)

* chore(cpex): set term to next term instead of current (nusmodifications#3631)

* Change MPE to CPE and Open MPE (nusmodifications#3623)

* Fix serverless function not working (nusmodifications#3623)

* Change modules to courses (nusmodifications#3623)

* Change inS1 and inS2 from mpe to cpex and fix private key parsing (nusmodifications#3623)

* Change package.json to use openssl legacy (nusmodifications#3623)

Change package.json to set env variable(nusmodifications#3623)

* Remove nodeoptions from package.json and change mpe api link (nusmodifications#3623)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Goh <chrisgzf@gmail.com>
Co-authored-by: Ravern Koh <ravernkoh@gmail.com>
alissayarmantho pushed a commit to alissayarmantho/nusmods that referenced this pull request Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants