Giter Site home page Giter Site logo

metakgp / chillzone Goto Github PK

View Code? Open in Web Editor NEW
21.0 14.0 26.0 6.97 MB

Find a place to chill during class hours in IIT KGP

Home Page: https://chill.metakgp.org

License: GNU General Public License v3.0

Go 11.86% Roff 1.25% HTML 58.96% Python 5.22% CSS 1.02% JavaScript 21.58% Shell 0.12%
classroom academic hacktoberfest

chillzone's Introduction

Contributors Forks Stargazers Issues GPL v3 Wiki


image

Chillzone

Will find you a chillzone inside IIT KGP at any time.
Website ยท Report Bug

Table of Contents

Local Installation

To run Chillzone front-end on your local system.

  1. Make sure you have pnpm installed on your system. Installation instructions can be found here.

  2. Clone the repo and change directory.

    git clone https://github.com/metakgp/chillzone
    
    cd chillzone/frontend
    
  3. Install modules and launch frontend.

    pnpm install
    pnpm start
    

(Back to top)

Updation for a new semester

For First Year Timetable

Note: First year timetable needs to be updated at the start of a new session only.

  1. Download first year timetable from ERP and place it in the first-year-scraper/ directory.

  2. Install dependencies.

    cd first-year-scraper
    
    pip install -r requirements.txt
    

For Second Year and above Timetable

Updating .env file

Note: Use .env.template file as the base for .env file.

Update the SESSION and SEMESTER environment variables.

Note: In case you are unable to scrape the new semester's timetable, then, these steps will help you find the problem:

  1. Turn on DEBUG inside the .env file by setting it to "1".
  2. Reduce the size of the departments array to 2 so that you are not buried with output in the terminal.

Final steps

  1. Run update_data.sh.

(Back to top)

Meanings of the various files

Input Files

  • problems.json

    JSON file that stores problems reported by users. Sometimes, the ERP might show that course A is scheduled to be held in room B, but later, due to (say) too many students, the course might be moved to a bigger room C. Then, a few nodes can be added to the JSON file without touching other files and the schedule can be regenerated.

  • first-year.csv

    The first year timetable is not available by default on ERP, so we need to add it manually using the central timetable PDF. This CSV file will be taken into consideration when the schedule is constructed. Refer to the template for details.

Output Files

  • schedule.json

    This is JSON file whose keys are the names of the rooms. Each value is a matrix with 5 rows and 9 columns. Each element in the matrix is the subject code of the class that will be held in that room during that one-hour slot. This string can be empty to show that the room will remain empty.

  • empty_schedule.json

    This is a JSON file that stores a matrix with 5 rows and 9 columns. Each element of the matrix is a list of strings containing the list of rooms that are free during that one hour slot.

  • subjectDetails.json

    This JSON file is used to show the tooltip with the name of the course and the name of the professors on top of the timetable entry in the chillzone webpage. It is a JSON file where the keys are subject codes and the values are strings with this structure: <SUBJECT NAME> - <PROFESSOR NAMES>.

(Back to top)

Development Notes

This package utilizes iitkgp-erp-login-go package to handle ERP login functionality and fetch timetables.

(back to top)

Maintainer(s)

(Back to top)

Contact

๐Ÿ“ซ Metakgp - Metakgp's slack invite Metakgp's email metakgp's Facebook metakgp's LinkedIn metakgp's Twitter metakgp's Instagram

(Back to top)

Additional documentation

(Back to top)

chillzone's People

Contributors

chirag-ghosh avatar devadeut avatar hahkarthick avatar harshkhandeparkar avatar iakshat avatar icyflame avatar kaustubhrakhade avatar nepalivai avatar proffapt avatar rajivharlalka avatar shikharish avatar sriyash421 avatar thealphadollar avatar themousepotato avatar vaidehi2000 avatar yoganshsharma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chillzone's Issues

IIT KGP CONNECTION FOR LOCAL DEV

As we open the website it shows that we need to be connected to IITKGP network . How to overcome this issue in local development
image

Automatic deployment of frontend

Currently we need to manually deploy frontend by creating a build in local and running pnpm run deploy. Automate this process such that the deployment is always from the most updated version of the master branch. Additionally create another github action which builds the frontend whenever there is a PR and allows merge only if the build was successful.

Tasks:

  • Automatically build and deploy from the master branch
  • Check whether the frontend build is successful for each PR.

[BUG] Doesn't fetch time table for breadths

Currently the backend is unable to fetch time table for breadths [confirmed for
2018-2019 AUTUMN HSS].

It shows misleading data to users of chillzone.

The solution could be creation of a standalone API (integration is also not discouraged) which can be called using REST API. It can also be used, then, with other projects under metaKGP.

Slot X4 is not hardcoded? BS and EVS not shown on Chillzone.

This slot is used each year for BS and EVS. It's classified as a LAB slot though, so maybe I didn't put this into the slots file which is why BS and EVS are not shown on Chillzone even though they are offered in both semesters.

Someone with access to the ERP timetable, please check this and add it to the problems file.

Separation between data and code

While reading through the codebase, I found a couple of instances where we have hardcoded data:

  • departments in main.go
  • rooms in rooms.go

We can migrate these to their respective JSON files and read the data into the program whenever necessary. This will also help us abstract lots of details into useful and extensible data structures.

enhance readme

Is your feature request related to a problem? Please describe.
can u add contribution.md and code of conduct.md in it?

Describe the solution you'd like
will add 2 files

Additional context
Add any other context or screenshots about the feature request here.

get a logo

Logos are nice. Help build visibility. If not possible by self, get someone else to help you out and provide them due credit for help. Collaboration is great.

Each subject should be a struct object instead of a []string

Currently, subjects are represented as []strings instead of a struct which has these keys.

Doing this will allow us to eliminate the change_map_structure step from the process. The conversion from []string to the struct can be done here, by iterating over each element of dep_val.Subjects and assigning it to the appropriate field of the struct. Validations can also be put in at this stage (eg: L-T-P must be #-#-#, Credits must be a valid integer, etc)

Workflow For Updating The Data

Is it possible to make a github actions workflow that updates the data each semester?

If not, we could make a workflow that, given the timetable link, generates all data and updates the frontend. This workflow could be triggered by a release or on push.

take place suggestions

optionally take suggestions of "where are you now?" and suggest places nearby that OR place/complex to prefer first

Transparency regarding what is meant by "empty" classrooms

Is your feature request related to a problem? Please describe.
Users think that the classrooms listed as empty are meant to be available as "free to use". This is not always the case. Classrooms listed as empty only mean that those rooms are supposed to be free of any classes according to the timetable at ERP. Many a times professors change the classroom which is not reflected in ERP. Also suppose a classroom has no classes in a particular day, it is possible that the guards might decide to not unlock the room at all making it inaccessible (very often the case with Vikramshila classrooms).

Describe the solution you'd like
Show a single line info banner on top of the website with a text like "The empty classes listed below might not be accurate in real life." There will also be a learn more button which will redirect to a page which clearly explains the various situations described above.

Describe alternatives you've considered
People will understand - Does not work

Progress Tracker

Changes to be made:

  • Move frontend to main repo (#27 )
  • Rewrite first year scraper (#38 )
  • Make the directory structure cleaner (#38 )
  • Host frontend somewhere
  • Rewrite README in the same format as gyft. (#41 )

Further frontend changes:

  • better directory structure
  • Update all packages and move from class components to functional components
  • Introduce typescript
  • add metatags
  • use CSS modules / styled components

Support for Python > 3.8

The PDF library used to read timetables, camelot-py, only supports Python versions 3.6, 3.7, and 3.8. Support for Python 3.10+ would be mandatory in a year since 3.8 will stop receiving security updates in Oct 2024.

Possible solutions:

  • Use an alternate PDF library
  • Fork and update the current library

Chillzone unable to scrape data from ERP. ERP says "Some system error occurred"

ERP returns "Some system error occurred." on running main.go

Curl request doesn't seem to be the problem because subjects are returned when the following curl request is run with a valid JSESSIONID.

curl 'https://erp.iitkgp.ernet.in/Acad/timetable_track.jsp?action=second&dept=AE' \
    -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cookie: JSESSIONID=ABCD.worker3;' \
    --data 'for_session=2018-2019&for_semester=AUTUMN&dept=AE'

Output on d66c0e7:

# siddharth @ siddharth-dell in /media/siddharth/code/personal-projects/chillzone on git:master x [20:24:51]
$ pl

# siddharth @ siddharth-dell in /media/siddharth/code/personal-projects/chillzone on git:master x [20:25:33]
$ go build && ./chillzone | clipcopy

# siddharth @ siddharth-dell in /media/siddharth/code/personal-projects/chillzone on git:master x [20:25:33]
$ go build && ./chillzone
2018/07/23 20:25:47 Starting request for department AE
2018/07/23 20:25:47 Starting request for department AG
2018/07/23 20:25:48 Request completed. Returning response now. Response length: 4231
2018/07/23 20:25:48 Parsing HTML string now
2018/07/23 20:25:48 Found 0 subjects in department AE
2018/07/23 20:25:48
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>Welcome to ERP</title>
        <meta charset="windows-1252">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
        <script src="jquery/jquery-1.10.2.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
                <!-- START ENTRUST.NET SEAL CODE -->
                <script type="text/javascript">
                          (function(d, t) {
                                var s = d.createElement(t), options = {'domain':'*.iitkgp.ac.in','style':'9','container':'entrust-net-seal'};
                                s.src = 'https://seal.entrust.net/sealv2.js';
                                s.async = true;
                                var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
                                s.onload = s.onreadystatechange = function() {
                                var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
                                try{goEntrust(options)} catch (e) {} };
                                })(document, 'script');
                </script>
    </head>
    <body>
        <!-- Border Div -->
        <div class="container navbar-inverse" style="width: 100%; height: 5px"></div>
        <!-- Header Div -->
        <div class="container navbar-static-top" style="width: 100%; padding-left: 0px; padding-right: 0px">
            <div class="row">
                <div class="col-md-5">
                    <img  height="100%" width="100%" src="./images/ERP-Banner.gif"/>
                </div>
                <div class="col-md-5"></div>
                <div class="col-md-2 hidden-sm hidden-xs" style="padding-top: 10px">
                    <table width="135" border="0" cellpadding="2" cellspacing="0" title="Click to Verify - This site chose Entrust SSL for secure e-commerce and confidential communications.">
                        <tr>
                                                        <td width="135" align="center" valign="top">
                                                                <div id="entrust-net-seal"><a href="https://www.entrust.com/ssl-certificates/"></a></div>
                                                                <a target="_blank"  style="color:#000000; text-decoration:none; font:bold 9px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">About SSL Certificate</a>
                                                        </td>
                        <!--td width="135" align="center" valign="top"><script type="text/javascript" src="https://seal.websecurity.norton.com/getseal?host_name=erp.iitkgp.ernet.in&amp;size=M&amp;use_flash=NO&amp;use_transparent=NO&amp;lang=en"></script><br />
                        <a href="http://www.symantec.com/ssl-certificates" target="_blank"  style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">ABOUT SSL CERTIFICATES</a></td-->
                        </tr>
                    </table>
                </div>
                <!--div class="col-md-3 hidden-sm hidden-xs"><img class="img-rounded pull-right" height="100%" width="100%" src="html/images/s1.gif"/></div-->
            </div>
        </div>
        <!-- Border Div -->
        <div class="container navbar-inverse" style="width: 100%; height: 5px"></div>
    </body>
</html>

<html>
    <head>
        <title>ERP System, IIT Kharagpur</title>
        <meta charset="windows-1252">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
        <script src="../jquery/jquery-1.10.2.js"></script>
        <script src="../bootstrap/js/bootstrap.min.js"></script>
    </head>
<body>
    <div id="includedContent"></div>
    <div class="container-fluid" style="padding-top: 5px">
        <div class="panel panel-danger">
            <div class="panel-heading">
                <h3 class="panel-title"><strong>ERROR !!!</strong></h3>
            </div>
            <div class="panel-body">

                    <p class="text-justify text-danger"><strong>Some system error occurred.</strong></p>

            </div>
        </div>
    </div>
</body>
</html>
2018/07/23 20:25:48 0 SUBJECTS FOUND

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.