{"id":21176874,"url":"https://github.com/monashcoding/thebetterhandbookapi","last_synced_at":"2025-04-13T15:52:07.121Z","repository":{"id":87895013,"uuid":"531893001","full_name":"monashcoding/TheBetterHandbookAPI","owner":"monashcoding","description":"The definitive Monash handbook API.","archived":false,"fork":false,"pushed_at":"2022-09-24T06:59:17.000Z","size":108,"stargazers_count":5,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T06:44:56.500Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monashcoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-02T11:11:15.000Z","updated_at":"2024-12-04T10:43:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"b81e7316-36ee-4fcf-a9f9-f4c1f27216f0","html_url":"https://github.com/monashcoding/TheBetterHandbookAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monashcoding%2FTheBetterHandbookAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monashcoding%2FTheBetterHandbookAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monashcoding%2FTheBetterHandbookAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monashcoding%2FTheBetterHandbookAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monashcoding","download_url":"https://codeload.github.com/monashcoding/TheBetterHandbookAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741146,"owners_count":21154249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T17:13:47.510Z","updated_at":"2025-04-13T15:52:07.115Z","avatar_url":"https://github.com/monashcoding.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TheBetterHandbookAPI\n\nThe definitive Monash handbook API.\n\n## Using the handbook API\n\nTo request the Monash handbook from the URL `https://handbook.monash.edu/api/es/search` (POST) send the following JSON:\n\n```py\n{\n            \"query\": {\n                \"bool\": {\n                    \"must\": [\n                        {\"query_string\": {\"query\": f\"monash2_psubject.code: {content}\"}},\n                        {\"term\": {\"live\": True}},\n                    ]\n                }\n            },\n            \"aggs\": {\n                \"implementationYear\": {\n                    \"terms\": {\n                        \"field\": \"monash2_psubject.implementationYear_dotraw\",\n                        \"size\": 100\n                    }\n                },\n                \"availableInYears\": {\n                    \"terms\": {\"field\": \"monash2_psubject.availableInYears_dotraw\", \"size\": 100}\n                },\n            },\n            \"size\": 100,\n            \"_source\": {\n                \"includes\": [\"versionNumber\", \"availableInYears\", \"implementationYear\"]\n            },\n}\n```\n\nNote that replacing `monash2` with `unsw` will let you request UNSW units. Additionally, content should be a unit code. This API for querying hasn't been documented properly, and there are likely many filters etc. There is also a request that can return all 5282 or so Monash units below:\n\n```python\n{\n    \"query\": {\n        \"bool\": {\n            \"must\": [\n                {\"term\": {\"live\": True}},\n                [\n                    {\n                        \"bool\": {\n                            \"minimum_should_match\": \"100%\",\n                            \"should\": [\n                                {\n                                    \"query_string\": {\n                                        \"fields\": [\n                                            \"monash2_psubject.implementationYear\"\n                                        ],\n                                        \"query\": f\"*{year}*\",\n                                    }\n                                }\n                            ],\n                        }\n                    }\n                ],\n            ],\n            \"filter\": [{\"terms\": {\"contenttype\": [\"monash2_psubject\"]}}],\n        }\n    },\n    \"sort\": [{\"monash2_psubject.code_dotraw\": {\"order\": \"asc\"}}],\n    \"from\": start,\n    \"size\": size,\n    \"track_scores\": True,\n    \"_source\": {\n        \"includes\": [\n            \"*.code\",\n            \"*.name\",\n            \"*.award_titles\",\n            \"*.keywords\",\n            \"urlmap\",\n            \"contenttype\",\n        ],\n        \"excludes\": [\"\", None],\n    },\n}\n```\n\n## Using the MonPlan API\n\nMonPlan POSTs a request to `https://mscv.apps.monash.edu` with a course plan in JSON format. You can send up to 125 units in one request before it will fail:\n\n```py\n{\n\"startYear\": 2022,\n\"advancedStanding\": [\n\n],\n\"internationalStudent\": False,\n\"courseInfo\": {\n\n},\n\"teachingPeriods\": [\n    {\n        \"year\": 2022,\n        \"code\": \"S1-01\",\n        \"units\": [\n                {\n                    \"unitCode\": unit_code,\n                    \"placeholder\": False\n                } for unit_code in units\n        ],\n        \"intermission\": False,\n        \"studyAbroad\": False\n    }\n]\n}\n```\n\nHere `units` is a list of unit codes.\n\n### Collating all data\n\nTo collate all data into a `.json` file run the following:\n\n```\npython -m src.data_processing.collate_handbook_data\n```\nThis process will take 2-3 minutes.\n\n## TODO\n\n- Code review\n- Remove units that are no longer offered\n- Incorporate data patcher after collating (ADD,SET) operation, set for cp, add for rule that doesn't get added\n- https://ipython-books.github.io/64-visualizing-a-networkx-graph-in-the-notebook-with-d3js/ \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonashcoding%2Fthebetterhandbookapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonashcoding%2Fthebetterhandbookapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonashcoding%2Fthebetterhandbookapi/lists"}