{"id":15899409,"url":"https://github.com/jmloyola/erisk_mock_server","last_synced_at":"2026-05-08T19:33:58.283Z","repository":{"id":73414947,"uuid":"442170905","full_name":"jmloyola/erisk_mock_server","owner":"jmloyola","description":"Mock server for the eRisk challenge.","archived":false,"fork":false,"pushed_at":"2023-01-02T02:04:00.000Z","size":369,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-24T23:33:15.286Z","etag":null,"topics":["docker","erisk","fastapi","mock-server","python","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmloyola.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":"2021-12-27T13:39:29.000Z","updated_at":"2024-02-26T21:34:55.000Z","dependencies_parsed_at":"2023-02-28T00:30:47.879Z","dependency_job_id":null,"html_url":"https://github.com/jmloyola/erisk_mock_server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jmloyola/erisk_mock_server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Ferisk_mock_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Ferisk_mock_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Ferisk_mock_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Ferisk_mock_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmloyola","download_url":"https://codeload.github.com/jmloyola/erisk_mock_server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmloyola%2Ferisk_mock_server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32794716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["docker","erisk","fastapi","mock-server","python","sqlite3"],"created_at":"2024-10-06T10:21:02.152Z","updated_at":"2026-05-08T19:33:58.266Z","avatar_url":"https://github.com/jmloyola.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/442170905.svg)](https://zenodo.org/badge/latestdoi/442170905)\n\n# eRisk mock server\nMock server for the [eRisk challenge](https://erisk.irlab.org/).\n\nThis server resembles the original eRisk server. It allows teams to:\n- Get writings for a given task.\n- Post the results of a run.\n\nBesides those, the mock servers can:\n- Create new teams (used mainly to experiment with different models and parameters).\n- List the teams in the system.\n- List the teams that have finished processing the input.\n- Get information of a given team.\n- Calculate time aware measures for a given team that have finished processing the input.\n- List the results for the teams that have finished.\n- Get the results of a given team.\n- Graph the final separation plot for a given team.\n- Graph separation plot for a given team and time.\n- Graph score evolution for a given user, team and run.\n- Graph score evolution of a random users for a given team and run.\n- Graph the elapsed time from all the teams that had finished processing the input.\n- Graph the elapsed time from all the selected runs of a team.\n- Show a table with the results of all finished experiments.\n- Graph the time the server took to answer the requests from all the teams that had finished processing the input.\n- Graph the time the server took to answer the GET requests from a team that had finished processing the input.\n- Graph the time the server took to answer the POST requests from a team that had finished processing the input.\n- Graph stats about the time the server took to answer the GET requests from all the teams that had finished processing the input.\n- Graph stats about the time the server took to answer the POST requests from all the teams that had finished processing the input.\n\n## Environment set up\nTo set up the environment we used [miniconda](https://docs.conda.io/en/latest/miniconda.html).\nOnce you have miniconda installed, run:\n```bash\nconda env create -f environment.yml\n```\n\n## Project configuration\nBefore running the server, make sure to configure the server editing the `config.py` file.\n\n## Corpus structure\nWe assume that each corpus has the following structure:\n- One line per user.\n- Each line is divided in two parts separated by a tab (`\\t`).\n    The first token represents the class the current user belongs to:\n    _\"positive\"_ or _\"negative\"_. Then, all the user documents follow.\n- Each user document is separated by a special token declared in the `config.py` file.\n    Edit the `end_of_post_token` variable.\n\n## Run the server\nTo run the server use:\n```bash\nuvicorn mock_server:app --host 0.0.0.0 --port 8000\n```\n\nTo check all the available endpoints, go to the [documentation](http://localhost:8000/docs).\n\n## Example client\nThe script `client.py` shows how to consume the API.\nThis is a simple example that get writings for a task and post a random response.\nYou can get the all the available parameters of the script using:\n```bash\npython -m client --help\n```\n\n## Docker image\nIf you want to use a Docker image to run the mock server, you can follow these steps.\n\nBuild the docker image with:\n```bash\ndocker build --tag mock_server_image .\n```\n\nNote that if you changed the location of the datasets (the default location is\nin subfolder called \"datasets\"), you will have to change the path in the\n`Dockerfile`.\n\nTo check the available docker images, use:\n```bash\ndocker image ls\n```\n\nIn case you want to remove the created image you can use:\n```bash\ndocker image rm mock_server_image\n```\n\nFinally, to run the mock server with a persistent database, use:\n```bash\ndocker run --detach --name mock_server --publish 8000:8000 \\\n    --volume mock_server_db:/app/database/ mock_server_image\n```\n\nThe `--detach` option makes the container run in the background. If you want to\nsee the terminal output directly, you can remove it.\n\nAnother way to look at the logs of the container when using the `--detach` option\nis to use:\n```bash\ndocker logs mock_server\n```\n\nTo check the status of all the containers, use:\n```bash\ndocker ps --all\n```\n\nTo check the resources used by the container, use:\n```bash\ndocker stats mock_server\n```\n\nTo stop the container, use:\n```bash\ndocker stop --time 2 mock_server\n```\n\nTo remove the container, use:\n```bash\ndocker rm mock_server\n```\n\nIn case a container failed (it is stopped now) and you want to run it again, you will have to\nremove it. You can remove with the previous commando or, you can prune all stopped instances with:\n```bash\ndocker container prune\n```\n\nif you want to inspect the persisted database, you can use:\n```bash\ndocker volume inspect mock_server_db\n```\nThis will tell you the location of the database in your disk.\nThe `Mountpoint` is the actual location on the disk where the data is stored.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmloyola%2Ferisk_mock_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmloyola%2Ferisk_mock_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmloyola%2Ferisk_mock_server/lists"}