Coder Social home page Coder Social logo

kshitij10496 / hercules Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 18.0 467 KB

The mighty hero helping you build projects on top of IIT Kharagpur's academic data

Home Page: https://hercules-10496.herokuapp.com/api/v1/static/index.html

License: MIT License

Dockerfile 0.32% Go 82.88% Python 12.55% Makefile 0.23% CSS 0.49% HTML 3.30% Shell 0.23%

hercules's People

Contributors

ayushk4 avatar cod3rboy avatar eransevi avatar geektimus avatar icyflame avatar lhauspie avatar pikachu920 avatar rafaelhenrique avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

hercules's Issues

Add script to login to erp during runtime while extracting the data.

As of now, we have to pass the cookie as an argument while running the extract data scripts.

We can use a web scraper /web driver ( selenium or robobrowser ) and login into erp while running the script. This will prompt the user to input the roll number and the password and the security question. Note that this won't be storing any password or other details that were input This will save us the trouble of having to log in and then copy paste the cookies.

This will make it easier for running the scripts to update every sem.

Testing HTTP Handlers

Writing HTTP Handlers before any unit tests might seem outrageously wrong.
I would agree with you on writing proper unit tests first, doing everything TDD, hands down.
This might not be ideal but it's the bare minimum which we should have before doing a public release.

If you are interested in writing unit tests/integration tests(with a mock DB), I would be happy to accommodate it and learn from you. ๐Ÿ˜ƒ

Rename the environment variable to DATABASE

The MVP of hercules used DATABASE_URL environment variable for the DB connection string.
Thanks to #6, we are now using envconfig for the management of configuration values.
Currently, the developer is required to set HERCULES_DATABASEURL for the same DB connection.

It would be aesthetically pleasing if someone can rename the variable to HERCULES_DATABASE instead.

Draw hercules art

Add a cool and funny doodle! ๐ŸŽจ
It would be nice if the art could be associated/symbolise strength and power in an abstract way. ๐Ÿ’ช

This is an open doodle/drawing challenge rather than a technical one.
So, draw something up on a piece of paper and share it in the comments below.
Thus, you don't necessarily have to fork the repo and open a PR in order to participate.

Prize: If the winner is studying at KGP, they get a GitHub Octocat sticker and a dinner treat!

Voting: Use ๐Ÿ‘ if you like a doodle. (Please do not use ๐Ÿ‘Ž as this be discouraging.)

Deadline: Thursday, 25th October

Sharing DB for development

@icyflame @amrav @DefCon-007 @athityakumar @thealphadollar

What is the best practice for providing read-access to the DB with anyone interesting in contributing to the project?
aka How do I share a replica of the production DB for local development?

From the top of my mind:

  • Creating a credential user for every individual with read access.
    • Cons:
      • Proxy connection under Institute's LAN is blocked.
      • Tedious process on the part of the project maintainer.
  • Storing a database dump in the repository.
    • Cons:
      • Regularly update the dump.
      • Bloats the size of the repo.

Create a docker-compose file for the application

It would be wonderful if we can get the application to run via a single command.
This would involve the use of docker-compose for managing multiple containers.
Ideally, we should have 2 services - one for the Postgres DB and another for the API.

Improve README

  • Add development guidelines to setup a local environment in a host machine and a docker container.
  • Add examples.

Support OPTIONS HTTP method

The idea is to enhance the security by restricting the clients to interact with the API only via GET requests. We need to add appropriate handler code and Access-Control-Allow-Methods response header.

Prettify JSON encoding after scapping data

Currently, I'm encoding the data scrapped from the timetable directly into a JSON. This is an ad-hoc way just to get things done. Ideally, we would want to store the data into a beautiful format, similar to what jq does.

Add indentation and formatting while encoding the scrapped data.
This would involve modifying the CourseEncoder class.

Refer: /data/scrapper/course_rooms.py

Add Semester dates

Add an API endpoint that contains current semester dates and previous historic dates.

Input validation checks

Task: Implement input validation checks/methods on the parameters sent by the user.

Currently, all the endpoint handlers expectedly delegate the task of validation to the corresponding logic layer. Now, its the responsibility of the logic layer to perform input validation and return proper errors back to the handler.

In order to start with the fix, we need to discuss what constitutes a valid entity.
For example, what needs to be checked in order to assure that a department/course is valid?

P.S: This would form the basis of developing a better error handling mechanism. ๐Ÿ˜„

Add missing data

Data related to first year academics cannot be scraped from ERP. Possibly find another way to add data. May be hard-code :) cc @icyflame

Make sure that a faculty can't be taking multiple subjects in same time on validation

Check this instance:

        {
            "course": {
                "name": "GRAPH THEORY AND ALGORITHMS",
                "code": "MA60041",
                "credits": 4
            },
            "slot": {
                "time": {
                    "day": "Monday",
                    "time": "12 PM"
                },
                "slot": "D4"
            },
            "rooms": [
                "NR223"
            ]
        },
        {
            "course": {
                "name": "GRAPH THEORY AND ALGORITHMS",
                "code": "MA61003",
                "credits": 4
            },
            "slot": {
                "time": {
                    "day": "Monday",
                    "time": "12 PM"
                },
                "slot": "D4"
            },
            "rooms": [
                "NR223"
            ]
        }
    ],

Here, MA60041 and MA61003 appears to be different but, under the same name GRAPH THEORY AND ALGORITHMS, same time 12 PM. Write validation conditions for such cases. @kshitij10496 WDYT?

Storing historical data from the ERP

This was discussed during Demo Day 10 on 9th November, 2018

Some of the data on the ERP has historical value. Some data (eg: grades) is very obviously useful historically, and should be a part of the present semester's data.

There is some other auxilliary information that would be useful for applications that might be developed later. Eg: Timetables, historical slot information.


Three components are required for the storage and retrieval of historical data to be frictionless:

  1. A method to retrieve the data through an API endpoint that uses a unique semester identifier

There is no semester specific code. Giving the identifier (say) /2018FALL/timetable/MA20001 will get you the data from that semester. Whereas /timetable/MA20001 would get you the data from the ongoing semester.

  1. A way to make present data historical and create empty present data

These (scripts?) make the movement of data between present and history easier. Once this is implemented, when 2018FALL is over, these two scripts will send the data in the "PRESENT" to "2018FALL" and create a new set of "PRESENT" data that is empty and would refer to the next semester "2019SPRING".

Because of (1), as soon as the data is moved to "2018FALL" specific data containers, the endpoints for historical data of that semester will magically start working! (Not magical as we have implemented it, but it would be magical because of how little you had to do to get it started)

  1. A way to swap out the data container that stores historical data

As @kshitij10496 put aptly in the demo day call, Heroku's free plans have restrictions. So, we need to be flexible about where we store the historical data. A crude solution is to store them in a JSON file. Another solution is to put a MongoDB or ElasticSearch instance or Postgres server on the metakgp main server.

Whatever be the case, the data layer should be easily swappable to be anything.


When the above three pieces are in place, we can start reliably providing historical data. We will also be able to provide this data quickly when a semester ends (because of (2)). And we will be able to adapt to changing conditions, cheaper services, new technology (because of (3))

Set Content-Type Response Header

At the moment, all the responses from the API v1 have their Content-Type set as text/plain by default.

Task: Explicitly set the Content-Type header in successful HTTP responses to application/json.

Create a project landing page

Currently, landing on the homepage results in a 404.
It would be cool if we could list all the endpoints currently supported by the API populated from this section for the time being.

I would be happy with a skeleton page, mostly using HTML and CSS.

Fix invalid room numbers

There are room numbers with value '0'. Replace those with 'In Dept'. Also, there are 'In Deptt'. Replace those with 'In Dept' ;)

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.