{"id":23819824,"url":"https://github.com/kth/kursutveckling-api","last_synced_at":"2025-07-12T16:36:26.111Z","repository":{"id":41987265,"uuid":"153595081","full_name":"KTH/kursutveckling-api","owner":"KTH","description":"Håller tjänster för att spara ner information om kursanalyser och kursdata relaterat till kursanalyser i sammanhanget av kursutveckling.","archived":false,"fork":false,"pushed_at":"2024-11-20T09:55:13.000Z","size":2997,"stargazers_count":4,"open_issues_count":12,"forks_count":0,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-20T11:08:24.494Z","etag":null,"topics":["api","kursutveckling","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/KTH.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-18T09:05:12.000Z","updated_at":"2024-09-03T12:35:28.000Z","dependencies_parsed_at":"2024-01-04T12:26:15.724Z","dependency_job_id":"6f055b35-593b-4935-9e2e-20f6956d3c98","html_url":"https://github.com/KTH/kursutveckling-api","commit_stats":null,"previous_names":[],"tags_count":2119,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkursutveckling-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkursutveckling-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkursutveckling-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkursutveckling-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KTH","download_url":"https://codeload.github.com/KTH/kursutveckling-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232163091,"owners_count":18481581,"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":["api","kursutveckling","swagger"],"created_at":"2025-01-02T07:16:03.135Z","updated_at":"2025-01-02T07:16:03.795Z","avatar_url":"https://github.com/KTH.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome to kursutveckling-api 👋\n\n![Version](https://img.shields.io/badge/version-0.8.0-blue.svg?cacheSeconds=2592000)\n![Prerequisite](https://img.shields.io/badge/node-18-blue.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)\n\n## Introduction\n\nThe course information project (KIP) is an initiative at KTH that was launched in 2018 to improve the quality and availability of information about KTH:s courses. The background to the project is, among other things, that it was difficult for the student to find information about the courses and even more difficult to compare information about several courses. The reason for the problems is scattered course information in several places and that there is no uniformity or assigned places for the course information. The project takes measures to consolidate course information into two locations and to present the information in a manner that is uniform for KTH. The student should find the right information about the course, depending on their needs. The result of the project is a public course site where the correct course information is collected and presented uniformly. Also, a tool is developed for teachers to enter and publish course information. Eventually, this will lead to the student making better decisions based on their needs, and it will also reduce the burden on teachers and administration regarding questions and support for the student.\n\nKursutveckling-api is a microservice to save course's analyses data to database, like text, numbers and names of pdf documents which are saved in kursinfo storage in Azure. It accepts data from kursutveckling admin pages \"Kursanalys och kursdata\"([kursutveckling-admin-web](https://github.com/KTH/kursutveckling-admin-web)) and serves this data to the public view of \"Course development and history\"([kursutveckling-web](https://github.com/KTH/kursutveckling-web))\n\nIt uses [Node.js](https://nodejs.org/), [Mongoose](https://mongoosejs.com/), `kth-node-mongo`, and is based on [node-api](https://github.com/KTH/node-api).\n\n*Please note!* \n\n*In March 2025, the tool \"Kursanalys och kursdata\"([kursutveckling-admin-web](https://github.com/KTH/kursutveckling-admin-web)) for publishing and editing course analysis and course data will be discontinued. Last use is for courses taken during study period 2 in Autumn 2024. From study period 3 in Spring 2025, course analysis is filled in and published in Canvas. The integration function ([kursutveckling-integration-api](https://github.com/KTH/kursutveckling-integration-api)) fetches and populates from then on the database with analysis data used by this repo's api `kursutveckling-api`.*\n\n### 🏠 [Homepage](https://github.com/KTH/kursutveckling-api)\n\n## Overview\n\nKursutveckling-api is used to save data in a Azure Cosmos database by using `kth-node-mongo` to establish a connection to Azure (`server/database.js`). Before using it, the database and collection must be prepared in Azure because it will establish a connection to an existing database, and not try to create it from a code. `Mongoose` is used for creating models and saving data. To present a documentation [Swagger](https://swagger.io/) is used.\n\nAdmin and public pages uses different rights and keys to separate their behaviour (write/read).\n\nOnly admin pages may change API data while public pages can only read. Therefore while using `Swagger`, a developer should choose the correct api key, because some functions will not be shown in details.\n\n### Connected Projects\n\n- [kursutveckling-web](https://github.com/KTH/kursinfo-web)\n- *~~[kursutveckling-admin-web](https://github.com/KTH/kursinfo-admin-web)~~ (Discontinued in March 2025)*\n- [kursutveckling-integration-api](https://github.com/KTH/ursutveckling-integration-api)\n\n### Related Projects\n\n- [node-api](https://github.com/KTH/node-api)\n- [kursstatistik-api](https://github.com/KTH/kursstatistik-api)\n\n## Prerequisites\n\n- Node.js 18\n- Ansible Vault\n\n### Secrets for Development\n\nSecrets during local development are ALWAYS stored in a `.env`-file in the root of your project. This file should be in .gitignore. MONGODB_URI is usually uses db in azure, but it also goes to use localhost mongo, it have a default value in `config/serverSettings.js`\n\n```\nMONGODB_URI=mongodb://kursutveckling-api-stage-mongodb-kthse:[password, specified in Azure]==@kursutveckling-api-stage-mongodb-kthse.documents.azure.com:[port, specified in Azure]/admin?ssl=true\u0026authSource=admin\nAPI_KEYS_0=?name=kursutveckling-web\u0026apiKey=[generate a password for public pages]\u0026scope=read\nAPI_KEYS_1=?name=kursutveckling-admin-web\u0026apiKey=[generate a password for admin page]\u0026scope=write\u0026scope=read\nAPPLICATIONINSIGHTS_CONNECTION_STRING=[Azure, Application insights, connection string, can be found in Overview]\nUSE_COSMOS_DB='true'\nLOGGING_ACCESS_LOG=debug\nSERVER_PORT=3001 [if you want to change port]\n```\n\nThese settings are also available in an `env.in` file.\n\n## Prepara Database in Azure\n\n1. Create database `admin` and advisible manually set Throughput: 400 (Shared)(Today it is 1000).\nName of database will be used in a connection string.\n2. In this database create a collection `roundanalyses`.\n3. Change a connection string by adding name of database (`admin`) after port slush `[port]/` and as a search query after `?` as `authSorce=admin`:\n\n`mongodb://kursutveckling-api-stage-mongodb-kthse:[password]==@kursutveckling-api-stage-mongodb-kthse.documents.azure.com:[port]`~~/?ssl=true~~`/admin?ssl=true\u0026authSource=admin`\n\nMore information can be found in Confluence: [Om kursen: Databas och API, connection string](https://confluence.sys.kth.se/confluence/x/a4_KC)\n\n\n## For Development\n\n### Install\n\n```sh\nnpm install\n```\n\n### Usage\n\nStart the service on [localhost:3001/api/kursutveckling/swagger](http://localhost:3001/api/kursutveckling/swagger).\n\n```sh\nnpm run start-dev\n```\n\n## In Production\n\nSecrets and docker-compose are located in cellus-registry.\n\n## Run tests\n\n```sh\nnpm run test\n```\n\n## Monitor and Dashboards\n\n### Application Status\n\n[localhost:3001/api/kursutveckling/\\_monitor](http://localhost:3001/api/kursutveckling/_monitor)\n\n### Branch Information\n\n[localhost:3001/api/kursutveckling/\\_about](http://localhost:3001/api/kursutveckling/_about)\n\n### Application Insights\n\nTo see more detailed behaviour in project, use `Application Insights`, e.g., `kursinfo-web-stage-application-insights-kthse`.\n\n## Use 🐳\n\nCopy `docker-compose.yml.in` to `docker-compose.yml` and make necessary changes, if any.\n\n```sh\ndocker-compose up\n```\n\n## Deploy in Stage\n\nThe deployment process is described in [Build, release, deploy](https://confluence.sys.kth.se/confluence/x/aY3_Ag). Technical details, such as configuration, is described in [How to deploy your 🐳 application using Cellus-Registy](https://gita.sys.kth.se/Infosys/cellus-registry/blob/master/HOW-TO-DEPLOY.md) and [🔧 How To Configure Your Application For The Pipeline](https://gita.sys.kth.se/Infosys/cellus-registry/blob/master/HOW-TO-CONFIGURE.md).\n\n### Edit secrets.env\n\n```sh\nansible-vault edit secrets.env\n```\n\nPassword find in gsv-key vault\n\n### Configure secrets.env\n\n```\nMONGODB_URI=mongodb://kursutveckling-api-stage-mongodb-kthse:[password, specified in Azure]==@kursutveckling-api-stage-mongodb-kthse.documents.azure.com:[port, specified in Azure]/admin?ssl=true\u0026authSource=admin\nAPI_KEYS_0=?name=kursutveckling-web\u0026apiKey=[generate a password for public pages]\u0026scope=read\nAPI_KEYS_1=?name=kursutveckling-admin-web\u0026apiKey=[generate a password for admin page]\u0026scope=write\u0026scope=read\nAPPLICATIONINSIGHTS_CONNECTION_STRING=[Azure, Application insights, connection string, can be found in Overview]\n```\n\n## Author\n\n👤 **KTH**\n\n- Website: https://kth.github.io/\n- Github: [@KTH](https://github.com/KTH)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkursutveckling-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkth%2Fkursutveckling-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkursutveckling-api/lists"}