ranking-challenge


Nameranking-challenge JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryThe Prosocial Ranking Challenge
upload_time2024-05-07 08:44:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords ranking social media challenge
VCS
bugtrack_url
requirements fastapi flask flask-cors httpx nltk openai pytest python-dotenv requests uvicorn ranking-challenge
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # The Prosocial Ranking Challenge

The Prosocial Ranking Challenge is designed to inspire, fund, and test the best algorithms to improve well-being, polarization, and factual knowledge for social media users. We will use our browser extension to re-order the feeds of paid U.S. participants on Facebook, Reddit, and X (Twitter) for four months, and measure changes in attitudes and behavior.

[More about the project here](https://humancompatible.ai/news/2024/01/18/the-prosocial-ranking-challenge-60000-in-prizes-for-better-social-media-algorithms/)

How do we identify pro- and anti-social content? That's where you come in! We are soliciting ranking algorithms to test, with $60,000 in prize money to be split between ten finalists (as selected by our panel of experts).

## pydantic models for the PRC API schema

You can use these models in your Python code, both to generate valid data, and to parse incoming data.

Using the models ensures that your data has been at least somewhat validated. If the schema changes and your code needs an update, you're more likely to be able to tell right away.

### Parsing a request

#### With FastAPI

If you're using fastapi, you can use the models right in your server:

```python
from ranking_challenge.request import RankingRequest
from ranking_challenge.response import RankingResponse

@app.post("/rank")
def rank(ranking_request: RankingRequest) -> RankingResponse:
    ...
    # You can return a RankingResponse here, or a dict with the correct keys and
    # pydantic will figure it out.
```

If you specify `RankingResponse` as your reeturn type, you will get validation of your response for free.

For a complete example, check out `../fastapi_nltk/`

#### Otherwise

If you'd like to parse a request directly, here is how:

```python
from ranking_challenge.request import RankingRequest

loaded_request = RankingRequest.model_validate_json(json_data)
```

### Generating fake data

There is a fake data generator, `rcfaker`. If you run it directly it'll print some.

You can also import it like so:

```python
from ranking_challenge.fake import fake_request, fake_response

# 5 fake reddit posts with 2 comments each
request = fake_request(n_posts=5, n_comments=2, platform='reddit')

# corresponding ranker response with 2 added items
request_ids = [r.id for r in request]
response = fake_response(request_ids, n_new_items=2)
```

For more in-depth examples, check out the tests.

### More

[The pydantic docs](https://docs.pydantic.dev/latest/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ranking-challenge",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "ranking, social media, challenge",
    "author": null,
    "author_email": "Ian Baker <ian@sonic.net>",
    "download_url": "https://files.pythonhosted.org/packages/7e/9d/6f688a4a2491e2ed3fc64dcd230d43c4f15c237c2ad69caf906af809b31d/ranking_challenge-1.0.2.tar.gz",
    "platform": null,
    "description": "# The Prosocial Ranking Challenge\n\nThe Prosocial Ranking Challenge is designed to inspire, fund, and test the best algorithms to improve well-being, polarization, and factual knowledge for social media users. We will use our browser extension to re-order the feeds of paid U.S. participants on Facebook, Reddit, and X (Twitter) for four months, and measure changes in attitudes and behavior.\n\n[More about the project here](https://humancompatible.ai/news/2024/01/18/the-prosocial-ranking-challenge-60000-in-prizes-for-better-social-media-algorithms/)\n\nHow do we identify pro- and anti-social content? That's where you come in! We are soliciting ranking algorithms to test, with $60,000 in prize money to be split between ten finalists (as selected by our panel of experts).\n\n## pydantic models for the PRC API schema\n\nYou can use these models in your Python code, both to generate valid data, and to parse incoming data.\n\nUsing the models ensures that your data has been at least somewhat validated. If the schema changes and your code needs an update, you're more likely to be able to tell right away.\n\n### Parsing a request\n\n#### With FastAPI\n\nIf you're using fastapi, you can use the models right in your server:\n\n```python\nfrom ranking_challenge.request import RankingRequest\nfrom ranking_challenge.response import RankingResponse\n\n@app.post(\"/rank\")\ndef rank(ranking_request: RankingRequest) -> RankingResponse:\n    ...\n    # You can return a RankingResponse here, or a dict with the correct keys and\n    # pydantic will figure it out.\n```\n\nIf you specify `RankingResponse` as your reeturn type, you will get validation of your response for free.\n\nFor a complete example, check out `../fastapi_nltk/`\n\n#### Otherwise\n\nIf you'd like to parse a request directly, here is how:\n\n```python\nfrom ranking_challenge.request import RankingRequest\n\nloaded_request = RankingRequest.model_validate_json(json_data)\n```\n\n### Generating fake data\n\nThere is a fake data generator, `rcfaker`. If you run it directly it'll print some.\n\nYou can also import it like so:\n\n```python\nfrom ranking_challenge.fake import fake_request, fake_response\n\n# 5 fake reddit posts with 2 comments each\nrequest = fake_request(n_posts=5, n_comments=2, platform='reddit')\n\n# corresponding ranker response with 2 added items\nrequest_ids = [r.id for r in request]\nresponse = fake_response(request_ids, n_new_items=2)\n```\n\nFor more in-depth examples, check out the tests.\n\n### More\n\n[The pydantic docs](https://docs.pydantic.dev/latest/)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The Prosocial Ranking Challenge",
    "version": "1.0.2",
    "project_urls": {
        "Blog": "https://rankingchallenge.substack.com/",
        "Homepage": "https://humancompatible.ai/news/2024/01/18/the-prosocial-ranking-challenge-60000-in-prizes-for-better-social-media-algorithms/",
        "Repository": "https://github.com/humancompatibleai/ranking-challenge"
    },
    "split_keywords": [
        "ranking",
        " social media",
        " challenge"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fccaaf715c170993ef957eaff079d91b36df81a4e0dde4c805828bf7cb6e5969",
                "md5": "ef05f484115c07c7711cdd141bcb4fde",
                "sha256": "a0d55fa70ba70d94d24ffcde863819c4f6c63762debd92cda65ee7bdedb652c7"
            },
            "downloads": -1,
            "filename": "ranking_challenge-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef05f484115c07c7711cdd141bcb4fde",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8852,
            "upload_time": "2024-05-07T08:44:18",
            "upload_time_iso_8601": "2024-05-07T08:44:18.808682Z",
            "url": "https://files.pythonhosted.org/packages/fc/ca/af715c170993ef957eaff079d91b36df81a4e0dde4c805828bf7cb6e5969/ranking_challenge-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e9d6f688a4a2491e2ed3fc64dcd230d43c4f15c237c2ad69caf906af809b31d",
                "md5": "916009a2c965ed5c3b88f8e00d5a59fa",
                "sha256": "63427e3b90986294c4dd4b393c2b5fb5321e858d1c6977021b5ee221c4b321cd"
            },
            "downloads": -1,
            "filename": "ranking_challenge-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "916009a2c965ed5c3b88f8e00d5a59fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8779,
            "upload_time": "2024-05-07T08:44:20",
            "upload_time_iso_8601": "2024-05-07T08:44:20.639994Z",
            "url": "https://files.pythonhosted.org/packages/7e/9d/6f688a4a2491e2ed3fc64dcd230d43c4f15c237c2ad69caf906af809b31d/ranking_challenge-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-07 08:44:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "humancompatibleai",
    "github_project": "ranking-challenge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "fastapi",
            "specs": [
                [
                    ">=",
                    "0.110.0"
                ]
            ]
        },
        {
            "name": "flask",
            "specs": []
        },
        {
            "name": "flask-cors",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        },
        {
            "name": "nltk",
            "specs": []
        },
        {
            "name": "openai",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "uvicorn",
            "specs": []
        },
        {
            "name": "ranking-challenge",
            "specs": []
        }
    ],
    "lcname": "ranking-challenge"
}
        
Elapsed time: 0.24644s