{"id":21880453,"url":"https://github.com/definetlynotai/test_generator","last_synced_at":"2025-07-21T07:31:47.366Z","repository":{"id":303214574,"uuid":"819480550","full_name":"DefinetlyNotAI/Test_generator","owner":"DefinetlyNotAI","description":"A tool to create datasets based on configurations from a csv file, This tool can be used as a skeleton for other software.","archived":true,"fork":false,"pushed_at":"2025-01-30T16:53:32.000Z","size":27581,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-06T11:49:49.548Z","etag":null,"topics":["algorithim","csv","data","development","dynamic","exam","generator","huge","nirt","powerful","python","skeleton","test","tools"],"latest_commit_sha":null,"homepage":"https://definetlynotai.github.io/Test_generator/","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/DefinetlyNotAI.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"DefinetlyNotAI","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"DefinetlyNotAI","custom":null}},"created_at":"2024-06-24T15:32:50.000Z","updated_at":"2025-04-04T11:20:10.000Z","dependencies_parsed_at":"2025-07-06T11:49:54.144Z","dependency_job_id":"1fcae023-635b-4276-bac6-64da8f1625b3","html_url":"https://github.com/DefinetlyNotAI/Test_generator","commit_stats":null,"previous_names":["definetlynotai/test_generator"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/DefinetlyNotAI/Test_generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinetlyNotAI%2FTest_generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinetlyNotAI%2FTest_generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinetlyNotAI%2FTest_generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinetlyNotAI%2FTest_generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DefinetlyNotAI","download_url":"https://codeload.github.com/DefinetlyNotAI/Test_generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefinetlyNotAI%2FTest_generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266261117,"owners_count":23901283,"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":["algorithim","csv","data","development","dynamic","exam","generator","huge","nirt","powerful","python","skeleton","test","tools"],"created_at":"2024-11-28T09:13:49.691Z","updated_at":"2025-07-21T07:31:46.831Z","avatar_url":"https://github.com/DefinetlyNotAI.png","language":"Python","funding_links":["https://github.com/sponsors/DefinetlyNotAI","https://buymeacoffee.com/DefinetlyNotAI"],"categories":[],"sub_categories":[],"readme":"# Exam Generator Server Project Documentation\r\n\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n    \u003ca href=\"https://github.com/DefinetlyNotAI/Test_generator/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/DefinetlyNotAI/Test_generator\" alt=\"GitHub Issues\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/DefinetlyNotAI/Test_generator/tags\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/DefinetlyNotAI/Test_generator\" alt=\"GitHub Tag\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/DefinetlyNotAI/Test_generator/graphs/commit-activity\"\u003e\u003cimg src=\"https://img.shields.io/github/commit-activity/t/DefinetlyNotAI/Test_generator\" alt=\"GitHub Commit Activity\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/DefinetlyNotAI/Test_generator/languages\"\u003e\u003cimg src=\"https://img.shields.io/github/languages/count/DefinetlyNotAI/Test_generator\" alt=\"GitHub Language Count\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/DefinetlyNotAI/Test_generator\"\u003e\u003cimg src=\"https://img.shields.io/github/repo-size/DefinetlyNotAI/Test_generator\" alt=\"GitHub Repo Size\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://codeclimate.com/github/DefinetlyNotAI/Test_generator/maintainability\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/31dde9ab1bb773ce9f31/maintainability\" /\u003e\u003c/a\u003e\r\n\u003c/div\u003e\r\n\r\n## Table of Contents 🔍\r\n\r\n- [Introduction](#introduction-)\r\n- [Integration](#integration-)\r\n- [Logging](#logging-information-)\r\n- [File Formatting](#file-formats-)\r\n  - [CSV](#csv-format-)\r\n  - [JSON](#config-json-format-)\r\n- [API Expectations](#database-expectations-api-)\r\n  - [REC](#rec-api-)\r\n  - [RUC](#ruc-api-)\r\n  - [RUD](#rud-api-)\r\n  - [RUR](#rur-api-)\r\n- [Error Handling](#error-messages-)\r\n- [Dependencies](#dependencies-)\r\n- [License](#license-)\r\n- [Contact](#contact-)\r\n\r\n## Introduction 🌟\r\n\r\nExam Generator is a REST API backend service that generates exams for a given subject\r\nand a given number of questions. The API is built using python and uses SQLite as the database.\r\nHere's a brief overview of the project:\r\n\r\n**DataBase.py**: This file contains the SQL class for the database operations. \r\nIt uses SQLite3 to interact with the SQLite database. \r\nIt also includes methods to create tables, insert data, update data, delete data, and query data.\r\nit also contains the Database class, which represents a usage of the exam generation.\r\nIt has properties included in the `config.json` file. \r\nIt is responsible for generating exams. \r\nIt takes a subject and the number of questions as parameters,\r\nand returns a list of randomly selected questions from the configuration file.\r\n\r\nThe API is designed to be scalable and can handle a large number of questions for each subject.\r\nIt also includes error handling and logging to ensure the smooth operation of the application.\r\n\r\nThe project is built using Python and SQLite as well as tiny amounts of PowerShell,\r\nit uses SQLite as the database. The API is designed to be static - non-returning flag\r\nand can be used with any frontend framework or application. \r\nThe API is LOCAL - So only having the source code in your server allows the APIs Usage or having the EXE.\r\n\r\n## Integration 🛠️\r\n\r\nIntegrating this project is super easy;\r\n\r\n1) Move this whole directory to your server's directory\r\n2) Make your server able to communicate and access `config.json` as well as the `DataBase.py` or `DataBase.exe`\r\n3)  All the server needs to do is modify the `config.json` file to include required parameters, then execute `DataBase.py ` or `DataBase.exe`\r\n4) Once executed a `Exam.xslx` file is produced, you can access it for you newly generated dataset\r\n5) OPTIONAL: A `.log` is also generated, in case of errors, fallback to it\r\n\r\n\r\n\r\nYou must place the secret key in the first line in the file `cat` or else after August 31st the software will fail. I will post the key in the future.\r\n\r\nThe `DataBase.py` will not communicate back to you in any way, in case of errors it won't communicate.\r\nReason being this has been tested vigorously, and only fails if the end user/front-end fails\r\nThe file will however create a `ERROR.temp` file incase a user fault occurs, it will contain predetermined messages,\r\nIf you want to use this feature, you must include a check on your end for the `ERROR.temp` file, and delete it\r\nafter reading its contents, The list of pre-defined errors are [here](#error-messages-)\r\n\r\nThe same goes with `DataBase.exe` but you actually run it rather than import it, and you should run with admin privileges\r\n\r\n## Logging Information 📝\r\n\r\nEverything that occurs is logged to a special `.log` file, it contains everything, You cannot disable this feature!\r\nIt does a neat log that contains the following headers:-\r\n\r\n- **Timestamp** Includes date and time of the log\r\n- **LOG Level** Includes the log level, ranges from INFO, WARNING, ERROR, CRITICAL\r\n- **Message** Includes the log message\r\n\r\nIt's all in a neat fashion, every time the software is re-opened anew, a special series of `-` appear to show\r\nit's a new log, without deleting previous ones.\r\n\r\nIf debugging, the CLI will show special `colorlog` messages that include exact realtime logging.\r\n\r\n## File Formats 📃\r\n\r\nThese will explain exactly the required formats, and tips on how to use them\r\n\r\n### CSV Format 📃\r\n\r\nThis usually should be static and human-controlled\r\n\r\nEach item must be separated by a comma, this produces a set, each set is separated by a new line,\r\nAn example of a `.csv` file;\r\n\r\n```csv\r\nQuestions,Question Type,Difficulty (Easy, Medium, Hard),Score\r\nq0001,t7,Easy,2\r\nq0002,t3,Easy,1\r\nq0003,t2,Medium,2\r\nq0004,t2,Medium,2\r\nq0005,t1,Easy,1\r\n```\r\n\r\nIn each line, only 4 items are allowed based on the headers\r\n`Questions, Question Type, Difficulty (Easy, Medium, Hard), Score`\r\n\r\nYou may also see it as `Data, Data Type, Action Difficulty, Weight` \r\nwhich is based on the application you are using\r\n\r\nA maximum of 100 points can be given to a question!\r\n\r\nThe encoding should be `UTF-8`\r\n\r\n### CONFIG JSON Format 👨‍💻\r\n\r\nThis should always change and be computer-controlled\r\n\r\nIn the `config.json` file, there are 10 keys:\r\n\r\n- `hard_data_to_use`: Integer: Amount of question to be classified as hard.\r\n- `medium_data_to_use`: Integer: Amount of question to be classified as medium.\r\n- `easy_data_to_use`: Integer: Amount of question to be classified as easy.\r\n- `minimum_titles`: Integer: The minimum amount of separate titles the exam should have. (For better chances of succeeding have it ~20% of total questions or else it results in impossible requests)\r\n- `total_points`: Integer: Exact amount of points the generated data set should have.\r\n- `use_debug_(ONLY_IF_YOU_DEVELOPED_THIS!)`: Boolean: DO NOT TAMPER.\r\n- `api`: String: API type to use, refer to [this](#database-expectations-api-) part of the documentation.\r\n- `username`: String: The USER that will be acted upon the database\r\n- `password`: String: The USER's PASSWORD that will be acted upon the database\r\n- `exclusion_titles`: List[String]: Titles you want to exclude from generation, this is very sensitive and CAN result in impossible requests\r\n\r\nAnd the base file should look like this:\r\n\r\n```json\r\n{\r\n      \"hard_data_to_use\": 2,\r\n      \"medium_data_to_use\": 1,\r\n      \"easy_data_to_use\": 3,\r\n      \"minimum_titles\": 3,\r\n      \"total_points\": 10,\r\n      \"use_debug_(ONLY_IF_YOU_DEVELOPED_THIS!)\": true,\r\n      \"api\": \"\",\r\n      \"username\": \"\",\r\n      \"password\": \"\",\r\n      \"exclusion_titles\": [\",\"]\r\n}\r\n```\r\n\r\nThe json file when read should always return a tuple of 10 items, \r\nin order `tuple[int, int, int, int, int, int, bool, str, str, str, list[str]]`\r\n\r\nNot following the format will result in a false bool thrown, which results in an error.\r\n\r\nPlease note the harsher you are in the rules the more impossible requests error will generate, \r\ntry to always have a ratio between given data (`.csv`) and rules.\r\n\r\nTo always make sure it will generate, try knowing the total questions you need (lets say 5) and go to your dataset, \r\nand use the first 5 to generate your configuration for yourself.\r\n\r\n## Database Expectations API 🗂️\r\n\r\n### REC API 🧠\r\n\r\nRequest Exam Creation\r\n\r\nThis will request to create an exam based on the users username and password,\r\nIt outputs an `.xslx` file\r\n\r\n### RUC API 👤\r\n\r\nRequest User Creation\r\n\r\nThis will request creating a username with the provided password,\r\nSaves to the `users.db`\r\n\r\nUsername MUST follow the following RegEx Pattern `^[a-zA-Z ]{3,30}$`\r\nPassword MUST follow the following RegEx Pattern `^[a-zA-Z0-9 _!?]{8,36}$`\r\n\r\n### RUD API 🔝\r\n\r\nRequest User DB Update\r\n\r\nThis requests adding extra exclusion titles to the username provided, requires a password\r\n\r\n### RUR API 🚫\r\n\r\nRequest User Removal\r\n\r\nRequests to remove the user via the password given as well.\r\n\r\n## Error Messages 🐛\r\n\r\nIn your end have a daemon thread that always checks if `ERROR.temp` exists, if it does, quickly read its contents (1 liner)\r\nand delete the file.\r\n\r\nThe contents include:-\r\n- **CS** - Corrupted Start - System files were corrupted or not found - No logs will generate - This is a crash\r\n- **IC** - Incorrect Credentials - The user has inputted wrong username or password.\r\n- **UKF** - Unknown Failure - A very broad error, Check the logs for the exact source - Requires human intervention\r\n- **IAPI** - Invalid API - The config file's API is wrong and not part of the 4 [APIs](#database-expectations-api-)\r\n- **CCD** - Corrupted Configuration Data - The configuration given is completely wrong and not valid - Check logs for further details\r\n- **CNU** - Corrupted New User - The content given is `None` (Occurs only in RUC) - Check logs for further details\r\n- **RGXF** - ReGeX Failure - The content given is failed to be validated by the ReGeX param, Due to the user inputting wrong data (Occurs only in RUC) - Check logs for further details\r\n- **CP** - Common Password - The password given is common and not valid either due to it being blacklisted OR due to it already being used (Occurs only in RUC) - Check logs for further details\r\n\r\nYou may automate special web error messages based on those codes.\r\n\r\n## Dependencies 📦\r\n\r\nJust install the dependencies using:\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\nNo need to update them later on to mediate crash risks, \r\nbut you may rerun the command to check for compatible newer versions.\r\n\r\n```text\r\nDateTime~=5.5\r\ncolorlog~=6.8.2\r\npandas~=2.2.2\r\n```\r\n\r\nYou are advised to run this software in a separate python environment.\r\n\r\n## License 📄\r\n\r\nThis project is licensed under the [MIT License](LICENSE). See the LICENSE file for details.\r\n\r\n## Contact 📧\r\n\r\nFor inquiries or contributions, please contact Shahm Najeeb at my email `Nirt_12023@outlook.com`.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefinetlynotai%2Ftest_generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefinetlynotai%2Ftest_generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefinetlynotai%2Ftest_generator/lists"}