galaxy_ng
galaxy_ng copied to clipboard
Community Surveys and Scoring
Community scoring in old galaxy was based on a computed average of survey responses from the UX users. On each role or collection, they could rate aspects of the content on a 1-5 scale or a yes/no (which translated to 1 or 5). A user could change their answers at will, but could not delete them. After the POST call to provide their responses, a new score for the content would be computed and displayed in the UX.
There was also a scoring component that derived from ansible-lint outputs, which was called "quality score". This PR does not attempt to re-implement that function.
The new endpoints are in api/v1 for multiple reasons:
- _ui/v1 is unsupported / unstable and flagged for migration to api/v3
- api/v3 is no longer truly a galaxy_ng controlled api but is instead a redirect to pulp.
- this feature is not yet ready for being a full on generic thing that is useful to satellite or other pulp stakeholders
- we need to iterate quickly on it for the community site
Example survey payload ...
{'docs': 3,
'does_what_it_says': 4,
'ease_of_use': 3,
'used_in_production': 1,
'works_as_is': 0}
For a role, the payload should be POST'ed to /api/v1/surveys/roles/<roleid>
/
For a collection, the payload should be POST'ed to /api/v1/surveys/collections/<namespace>
/<name>
/ ... because we have no way of getting the pulp_id for a collection from the API right now.
Computed scores come from these endpoints ...
(venv) [jtanner@p1 galaxy_ng]$ curl -s http://localhost:5001/api/v1/scores/roles/ | jq .
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 7,
"created": "2023-11-29T03:29:06.708629Z",
"modified": "2023-11-29T03:29:10.572142Z",
"role": 7,
"namespace": "jctannerTEST",
"name": "role1",
"score": "1.98"
}
]
}
(venv) [jtanner@p1 galaxy_ng]$ curl -s http://localhost:5001/api/v1/scores/collections/ | jq .
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"created": "2023-11-29T02:53:09.562222Z",
"modified": "2023-11-29T02:53:13.397804Z",
"collection": "018c18fe-59a2-7cd1-8574-ea51f2105133",
"namespace": "autohubtest2",
"name": "krdqdlyw",
"score": "2.40"
},
{
"id": 2,
"created": "2023-11-29T03:29:31.486404Z",
"modified": "2023-11-29T03:29:35.316854Z",
"collection": "018c191f-a4b8-74cd-9389-a597da785d66",
"namespace": "autohubtest2",
"name": "adozvbxh",
"score": "1.63"
}
]
}
Scores have namespace and name filtering ...
(venv) [jtanner@p1 galaxy_ng]$ curl -s 'http://localhost:5001/api/v1/scores/collections/?namespace=autohubtest2&name=adozvbxh' | jq .
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"created": "2023-11-29T03:29:31.486404Z",
"modified": "2023-11-29T03:29:35.316854Z",
"collection": "018c191f-a4b8-74cd-9389-a597da785d66",
"namespace": "autohubtest2",
"name": "adozvbxh",
"score": "1.63"
}
]
}
Both the role and the collection scores can be filtered by their roleid or collectionid, if known.
Would be nice to add a data migration reading the existing static data on https://galaxy.ansible.com/static/scores/role.json and https://galaxy.ansible.com/static/scores/collection.json and adding to the new datamodels.
@rochacbruno these models require the full survey data rather than the final computed scores. I've dumped everthing required and made scripts to import the old data here: https://github.com/jctanner/galaxy-hacking/blob/main/beta.surveys/load_data.py