{"id":22173481,"url":"https://github.com/jlumbroso/codepost-stats","last_synced_at":"2025-07-26T15:31:36.183Z","repository":{"id":37198379,"uuid":"243113363","full_name":"jlumbroso/codepost-stats","owner":"jlumbroso","description":"A system to compile statistics automatically from a course on the codePost platform.","archived":false,"fork":false,"pushed_at":"2023-02-11T00:44:18.000Z","size":191,"stargazers_count":9,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-10T21:48:44.718Z","etag":null,"topics":["codepost","codepost-api","codepost-platform","gamification","grading","metrics"],"latest_commit_sha":null,"homepage":"https://codepost-stats.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jlumbroso.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}},"created_at":"2020-02-25T22:11:17.000Z","updated_at":"2024-01-15T11:22:31.000Z","dependencies_parsed_at":"2023-01-25T17:01:30.338Z","dependency_job_id":null,"html_url":"https://github.com/jlumbroso/codepost-stats","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/jlumbroso%2Fcodepost-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlumbroso%2Fcodepost-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlumbroso%2Fcodepost-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlumbroso%2Fcodepost-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlumbroso","download_url":"https://codeload.github.com/jlumbroso/codepost-stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227690990,"owners_count":17805021,"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":["codepost","codepost-api","codepost-platform","gamification","grading","metrics"],"created_at":"2024-12-02T07:33:36.774Z","updated_at":"2024-12-02T07:33:37.495Z","avatar_url":"https://github.com/jlumbroso.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# codePost Statistics Compiler\n\n![pytest](https://github.com/jlumbroso/codepost-stats/workflows/pytest/badge.svg)\n [![codecov](https://codecov.io/gh/jlumbroso/codepost-stats/branch/master/graph/badge.svg?token=KVGWAVZKW1)](https://codecov.io/gh/jlumbroso/codepost-stats)\n [![Documentation Status](https://readthedocs.org/projects/codepost-stats/badge/?version=latest)](https://codepost-stats.readthedocs.io/en/latest/?badge=latest)\n [![Downloads](https://pepy.tech/badge/codepost-stats)](https://pepy.tech/project/codepost-stats)\n [![Run on Repl.it](https://repl.it/badge/github/jlumbroso/codepost-stats)](https://repl.it/github/jlumbroso/codepost-stats)\n [![Stargazers](https://img.shields.io/github/stars/jlumbroso/codepost-stats?style=social)](https://github.com/jlumbroso/codepost-stats)\n\nA system to compile statistics automatically from a course on the codePost platform.\n\n## Installation\n\nThe package is available on PyPI as slacktivate and so is available the usual way, i.e.,\n```shell\n$ pip install codepost-stats\n```\n\n## Example\n\n```python\nimport codepost\n\nimport codepost_stats\nimport codepost_stats.analyzers.abstract.simple\nimport codepost_stats.analyzers.standard\nimport codepost_stats.event_loop\n\n# Login\ncodepost.configure_api_key(\"\u003cCODEPOST_API_TOKEN\u003e\")\n\n# Create Course Analyzer Event Loop\ncael = codepost_stats.event_loop.CourseAnalyzerEventLoop(\n    course_name=\"COS126\",\n    course_term=\"S2020\",\n)\n\n# Create Analyzer\nclass SubmissionsGradedCounter(codepost_stats.analyzers.abstract.simple.CounterAnalyzer):\n    _name = \"submissions.graded\"\n    \n    def _event_submission(\n        self,\n        assignment: codepost.models.assignments.Assignments,\n        submission: codepost.models.submissions.Submissions,\n    ):\n        # if no grader, nothing to do\n        if submission.grader is None:\n            return\n        \n        # if not finalized, do not want to count it\n        if not submission.isFinalized:\n            return\n        \n        # increase number of graded submission for grader by 1\n        self._delta_counter(\n            name=submission.grader,\n            subcat=assignment.name,\n            delta=1,\n        )\n        \nsgc = SubmissionsGradedCounter()\n\n# Add the analyzer we just created\ncael.register(sgc)\n\n# Add a few standard analyzers\ncael.register(codepost_stats.analyzers.standard.CustomCommentsCounter)\ncael.register(codepost_stats.analyzers.standard.RubricCommentsCounter)\n\n# Run the aggregation of stats\ncael.run()\n\n# Extract statistics per user\nstatistics_per_user = {\n    name: cael.get_by_name(name)\n    for name in cael.names\n}\n```\nand the `statistics_per_user` variable would be a dictionary of the form:\n```json\n{\n  \"grader1@princeton.edu\": {\n    \"submissions.graded\": {\n      \"hello\": 5,\n      \"loops\": 6,\n      \"nbody\": 0,\n      \"sierpinski\": 8,\n      \"programming-exam-1\": 6,\n      \"hamming\": 0,\n      \"lfsr\": 2,\n      \"guitar\": 5,\n      \"markov\": 6,\n      \"tspp\": 4,\n      \"atomic\": 29\n    },\n    \"comments.counter.custom\": {\n      \"hello\": 9,\n      \"loops\": 6,\n      \"nbody\": 0,\n      \"sierpinski\": 14,\n      \"programming-exam-1\": 6,\n      \"hamming\": 0,\n      \"lfsr\": 4,\n      \"guitar\": 8,\n      \"markov\": 14,\n      \"tspp\": 7,\n      \"atomic\": 36\n    },\n    \"comments.counter.rubric\": {\n      \"hello\": 7,\n      \"loops\": 15,\n      \"nbody\": 0,\n      \"sierpinski\": 13,\n      \"programming-exam-1\": 8,\n      \"hamming\": 0,\n      \"lfsr\": 6,\n      \"guitar\": 10,\n      \"markov\": 17,\n      \"tspp\": 13,\n      \"atomic\": 38\n    }\n  },\n  \"grader2@princeton.edu\": {\n      /* ... grader2@princeton.edu's statistics here ... */\n  },\n  /* ... more graders ... */\n}\n```\n\n## License\n\nThis project is licensed [under the LGPLv3 license](https://www.gnu.org/licenses/lgpl-3.0.en.html),\nwith the understanding that importing a Python modular is similar in spirit to dynamically linking\nagainst it.\n\n- You can use the library/CLI `codepost-stats` in any project, for any purpose,\n  as long as you provide some acknowledgement to this original project for\n  use of the library (for open source software, just explicitly including\n  `codepost-stats` in the dependency such as a `pyproject.toml` or `Pipfile`\n  is acknowledgement enough for me!).\n\n- If you make improvements to `codepost-stats`, you are required to make those\n  changes publicly available.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlumbroso%2Fcodepost-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlumbroso%2Fcodepost-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlumbroso%2Fcodepost-stats/lists"}