Skip to content

iiumschedule/albiruni

Repository files navigation

Dart pub badge style: lints

A wrapper to easily access IIUM's Course Schedule website data.

Thank you @PlashSpeed-Aiman for the code foundation.

Get Started

  1. Run dart pub get
  2. Start development. Make sure to update/add the test file if needed. Run dart test to run test suite.

Open in GitHub Codespaces

Features

Get a list of subjects offered

Fetch of subjects for Kuliyyah of Economics for semester 1, 2021/2022 session:

// Create albiruni instance
Albiruni albiruni = Albiruni(semester: 1, session: "2021/2022");
// Use methods available in the classes
var (subjects, totalPage) = await albiruni.fetch("ECONS");

Supports both Undergraduate and Postgraduate studies. Pass the StudyGrade.ug (default) or StudyGrade.pg.

Albiruni(semester: 1, session: "2022/2023", studyGrade: StudyGrad.pg);

Search for specific subjects in a kulliyyah

Put the subject course code in the course parameter. The subject must be Albiruni-formatted, e.g. ABDC 1234 (see albiruni-formatted).

fetch("ECONS", course: "ECON 1140");

Here's some trick. Let's say you want to filter the courses for third-year subjects only, just provide the first digit and ignore the rest.

fetch("CCAC", course: "CCUB 3");

Albiruni-formatted

The course code must be in the following format: ABCD 1234. The first four characters are the subject code, and the last four characters are the subject number. The space is required. In some cases, the course code format might be different but generally, it will look like this.

Lucky for you, .toAlbiruniFormat() extension method will properly format the string for you. Useful when you're receiving input from the users etc.

var userInput = "ccub2621";
fetch("CCAC", course: userInput.toAlbiruniFormat()); // formatted: CCUB 2621

JSON

Parse subject data from JSON to Dart object, use fromJson() constructor.

Example JSON:

{
  "code": "CHEN 1212",
  "sect": 1,
  "title": "THERMODYNAMICS",
  "chr": 2.0,
  "venue": null,
  "lect": [
    "DR. MOHD. FIRDAUS BIN ABD. WAHAB",
    "ASSOC. PROF. DR. NOR FADHILLAH BT. MOHAMED AZMIN"
  ],
  "dayTime": [
    { "day": 1, "startTime": "11:30", "endTime": "12:50" },
    { "day": 3, "startTime": "11:30", "endTime": "12:50" }
  ]
}

Parse it like following:

var data = <yourjsonstring>
var subjects = Subject.fromJson(jsonDecode(data));

Similarly, you can convert Dart object to JSON using toJson() method.

I think that's it for the basic usage of this library, of course, you can always discover more. You can drop your inquiries in issues if you have any. More examples can be found in the /example folder.

Common issues

  • XMLHttpRequest error or CORS error

    Usually occurs if you're developing for the web. Set useProxy flag to true. This will add a proxy layer between the client and the albiruni server.

    fetch("ENGIN", course: "MCTE 3271", useProxy: true);
  • HandshakeException: CERTIFICATE_VERIFY_FAILED error.

    This happens when the albiruni server has some certificate issues. Some clients might reject the requests. If you're in development, try this answer from SO.

List of available kulliyyah (as of 7 August 2024)

Code Name
IRKHS AHAS KIRKHS
KAHS ALLIED HEALTH SCIENCES
AED ARCHITECTURE
BRIDG BRIDGING PROGRAMME
CFL CELPAD
CCAC COCU
DENT DENTISTRY
EDUC EDUCATION
ENGIN ENGIN
ECONS ENMS
KICT ICT
IHART INTERNATIONAL INSTITUTE FOR HALAL RESEARCH AND TRAINING
IIBF ISLAMIC BANKING AND FINANCE
ISTAC ISTAC
KLM KSTCL KLM
LAWS LAWS
MEDIC MEDICINE
NURS NURSING
PHARM PHARMACY
PLNET PLANETARY SURVIVAL FOR SUSTAINABLE WELL-BEING
KOS SCIENCE
SC4SH SEJAHTERA CENTRE FOR SUSTAINABILTY AND HUMANITY

This list of available kulliyyah might change over time, kindly refer to https://iiumschedule.iqfareez.com/docs/devs/albiruni#list-of-available-kulliyyah

Related information