{"id":18150926,"url":"https://github.com/yahrdev/engram_sync","last_synced_at":"2026-04-19T19:32:26.615Z","repository":{"id":258545125,"uuid":"874137464","full_name":"yahrdev/EnGram_sync","owner":"yahrdev","description":"The API generates tests for English grammar learning and can be used as a backend for English learning-related projects. The app was built using Flask and has two endpoints: gettests and updatestatus. The first endpoint generates one test each time it's called, while the second updates the date and time when the test was displayed on the frontend.","archived":false,"fork":false,"pushed_at":"2024-10-18T10:33:59.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T13:54:26.771Z","etag":null,"topics":["alembic","api","flask","flask-restx","mysql","pydantic","redis","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahrdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-10-17T10:11:44.000Z","updated_at":"2024-10-18T10:34:03.000Z","dependencies_parsed_at":"2024-10-21T13:19:32.561Z","dependency_job_id":null,"html_url":"https://github.com/yahrdev/EnGram_sync","commit_stats":null,"previous_names":["yahrdev/engram_sync"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2FEnGram_sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2FEnGram_sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2FEnGram_sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahrdev%2FEnGram_sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahrdev","download_url":"https://codeload.github.com/yahrdev/EnGram_sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247568168,"owners_count":20959746,"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":["alembic","api","flask","flask-restx","mysql","pydantic","redis","sqlalchemy"],"created_at":"2024-11-02T01:05:53.410Z","updated_at":"2026-04-19T19:32:26.582Z","avatar_url":"https://github.com/yahrdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"The **API** generates tests for English grammar learning and can be used as a backend for English learning-related projects.\n\nThe app was built using **Flask** and has two endpoints: `gettests` and `updatestatus`.\n\n- The first endpoint generates one test each time it's called.\n- The second endpoint updates the date and time when the test was displayed on the frontend.\n\nWhen the `gettests` endpoint is called, the app retrieves a fixed number of tests from the database and stores them in the cache. Users receive one test from the cache per call, which helps reduce database requests for every endpoint call. The tests are sorted by the datetime_shown field, so the test that was shown the longest time ago is displayed first. The `updatestatus` endpoint simply records the datetime when a test is shown, keeping the database up to date.\n\n## Technologies Used\n\n- **Flask**: For building the web API.\n- **SQLAlchemy**: For ORM functionality with MySQL.\n- **Flask-Migrate**: To handle database migrations.\n- **PyMySQL**: MySQL client for Python.\n- **Redis**: Used for managing the cache layer.\n- **Pydantic**: For data validation.\n- **Flask-RESTX**: For creating RESTful services and documenting them.\n- **Pytest**: For writing and running unit tests.\n\n## Installation\n\n### 1. Clone the repository\n\n```bash\ngit clone https://github.com/yourusername/EnGram_sync.git\n```\n\n### 2. Navigate into the project directory\n\n```bash\ncd EnGram_sync\n```\n\n### 3. Install the dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 4. Set up the environment\n\nCreate .env and .test.env files based on the provided examples. \n\n### 5. Set up the database\n\nCreate the database in MySQL and initialize and apply migrations:\n\n```bash\nflask db init\nflask db migrate -m \"Initial migration\"\nflask db upgrade\n```\nYou can use that [Initial Migration Script](https://github.com/yahrdev/EnGram_sync/blob/main/api/migrations/versions/3e4caf632902_initial_migration.py) which is provided in this repository.\nAlso populate the database with data. \n\n### 6. Set up Redis\n\nDownload Redis and place the folder on disk C (for example). Open a command prompt and navigate to the Redis folder:\n\n```bash\ncd C:\\Redis\n```\n\nSet up configuration files. You can either modify the redis.windows.conf or create two copies: redis-prod.conf and redis-test.conf, and specify different ports in each file.\nStart Redis servers:\n\n```bash\nredis-server.exe redis-test.conf\n```\n\n```bash\nredis-server.exe redis-prod.conf\n```\n\n### 7. Run the application\n\n```bash\npython api/app.py\n```\n\n### 8. Testing\n\n```bash\npytest -v tests/test_api.py  \n```\n\nAnd check Swagger: http://127.0.0.1:8000/docs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahrdev%2Fengram_sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahrdev%2Fengram_sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahrdev%2Fengram_sync/lists"}