# udata-recommendations
This plugin acts as a bridge between uData and a recommendation system.
In our case ([data.gouv.fr][]), it's a set of scripts living here https://github.com/etalab/piwik-covisits.
Recommendations are stored on datasets. Recommendations can come from various sources and are stored in a descending order, according to the provided score (from 1 to 100). The top recommendations are displayed at the bottom on the dataset page.
## Compatibility
**udata-recommendations** requires Python 3.7+ and [uData][].
## Installation
Install [uData][].
Remain in the same virtual environment (for Python).
Install **udata-recommendations**:
```shell
pip install udata-recommendations
```
Modify your local configuration file of **udata** (typically, `udata.cfg`) as following:
```python
PLUGINS = ['recommendations']
RECOMMENDATIONS_SOURCES = {
'source-name': 'https://path/to/recommendations.json',
'other-source': 'https://path/to/other/recommendations.json',
}
RECOMMENDATIONS_NB_RECOMMENDATIONS = 4
```
- `RECOMMENDATIONS_SOURCES`: A key-value dictionary of recommendation sources and URLs to fetch. _Default_: `{}`
- `RECOMMENDATIONS_NB_RECOMMENDATIONS`: The maximum number of recommendations to display on the dataset page. _Default_: `4`
## Usage
### Adding recommendations
You can fetch and store recommendations as a task, using your configuration in `RECOMMENDATIONS_SOURCES`, on a schedule if needed. By default, previous recommendations are cleaned before the importing new ones, but you're in control.
```shell
udata job run recommendations-add
# Don't clean each source before importing new recommendations
udata job run recommendations-add should_clean=false
```
### Deleting recommendations
To clean all recommendations, you can run the following task.
```shell
udata job run recommendations-clean
```
## Expectations
This plugin expects the following format to provide datasets recommendations:
```json
[
{
"id": "dataset-id",
"recommendations": [
{
"id": "dataset-slug-1",
"score": 100
},
{
"id": "5ef1fe80f50446b8f41ba691",
"score": 1
}
]
},
{
"id": "dataset-id2",
"recommendations": [
{
"id": "5ef1fe80f50446b8f41ba691",
"score": 50
}
]
}
]
```
Dataset IDs can be IDs or slugs. Scores should be between `1` and `100`, inclusive. You can validate your JSON using a [JSON Schema](udata_recommendations/schema.json).
[uData]: https://github.com/opendatateam/udata
[data.gouv.fr]: https://data.gouv.fr
# Changelog
## 3.1.5 (2023-11-21)
- Update Matomo content tracking data-attributes [#263](https://github.com/opendatateam/udata-recommendations/pull/263)
- Upgrade test and develop dependencies [#264](https://github.com/opendatateam/udata-recommendations/pull/264)
## 3.1.4 (2023-03-07)
- Update and compile translations [#261](https://github.com/opendatateam/udata-recommendations/pull/261) [#262](https://github.com/opendatateam/udata-recommendations/pull/262)
## 3.1.3 (2023-03-02)
- Recommendations for new dataset page [#256](https://github.com/opendatateam/udata-recommendations/pull/256)
## 3.1.2 (2022-12-15)
- Update dataset and reuse recommendations to match new udata-front layout [207](https://github.com/opendatateam/udata-recommendations/pull/207)
## 3.1.1 (2022-09-01)
- Replace mongo legacy image in CI [#226](https://github.com/opendatateam/udata-recommendations/pull/226)
- Store unique recommendations in extras [#239](https://github.com/opendatateam/udata-recommendations/pull/239)
## 3.1.0 (2021-09-16)
- Change udata-gouvfr dependency to udata-front following renaming [#188](https://github.com/opendatateam/udata-recommendations/pull/188)
## 3.0.0 (2021-08-12)
- Ensure compatibility with udata3 by changing imports and style [#183](https://github.com/opendatateam/udata-recommendations/pull/183)
## 2.2.0 (2020-11-30)
- Add reuses support [#153](https://github.com/opendatateam/udata-recommendations/pull/153)
## 2.1.1 (2020-10-16)
- Ignore recommendation of dataset itself [#147](https://github.com/opendatateam/udata-recommendations/pull/147)
## 2.1.0 (2020-08-25)
- Add score to recommendations and support multiple recommendation sources [#142](https://github.com/opendatateam/udata-recommendations/pull/142)
## 2.0.0 (2020-03-11)
- udata 2.0 / Python 3 support [#95](https://github.com/opendatateam/udata-recommendations/pull/95)
- Support new hooks format [#96](https://github.com/opendatateam/udata-recommendations/pull/96)
## 1.0.1 (2018-08-03)
- Nothing yet
## 1.0.0 (2018-06-06)
- Allow slug instead of id for datasets [#8](https://github.com/opendatateam/udata-recommendations/pull/8)
- Initial release
Raw data
{
"_id": null,
"home_page": "https://github.com/opendatateam/udata-recommendations",
"name": "udata-recommendations",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "udata recommendations",
"author": "Opendata Team",
"author_email": "contact@opendata.team",
"download_url": "",
"platform": null,
"description": "# udata-recommendations\n\nThis plugin acts as a bridge between uData and a recommendation system.\n\nIn our case ([data.gouv.fr][]), it's a set of scripts living here https://github.com/etalab/piwik-covisits.\n\nRecommendations are stored on datasets. Recommendations can come from various sources and are stored in a descending order, according to the provided score (from 1 to 100). The top recommendations are displayed at the bottom on the dataset page.\n\n## Compatibility\n\n**udata-recommendations** requires Python 3.7+ and [uData][].\n\n## Installation\n\nInstall [uData][].\n\nRemain in the same virtual environment (for Python).\n\nInstall **udata-recommendations**:\n\n```shell\npip install udata-recommendations\n```\n\nModify your local configuration file of **udata** (typically, `udata.cfg`) as following:\n\n```python\nPLUGINS = ['recommendations']\nRECOMMENDATIONS_SOURCES = {\n 'source-name': 'https://path/to/recommendations.json',\n 'other-source': 'https://path/to/other/recommendations.json',\n}\nRECOMMENDATIONS_NB_RECOMMENDATIONS = 4\n```\n\n- `RECOMMENDATIONS_SOURCES`: A key-value dictionary of recommendation sources and URLs to fetch. _Default_: `{}`\n- `RECOMMENDATIONS_NB_RECOMMENDATIONS`: The maximum number of recommendations to display on the dataset page. _Default_: `4`\n\n## Usage\n\n### Adding recommendations\n\nYou can fetch and store recommendations as a task, using your configuration in `RECOMMENDATIONS_SOURCES`, on a schedule if needed. By default, previous recommendations are cleaned before the importing new ones, but you're in control.\n\n```shell\nudata job run recommendations-add\n# Don't clean each source before importing new recommendations\nudata job run recommendations-add should_clean=false\n```\n\n### Deleting recommendations\n\nTo clean all recommendations, you can run the following task.\n\n```shell\nudata job run recommendations-clean\n```\n\n## Expectations\n\nThis plugin expects the following format to provide datasets recommendations:\n\n```json\n[\n {\n \"id\": \"dataset-id\",\n \"recommendations\": [\n {\n \"id\": \"dataset-slug-1\",\n \"score\": 100\n },\n {\n \"id\": \"5ef1fe80f50446b8f41ba691\",\n \"score\": 1\n }\n ]\n },\n {\n \"id\": \"dataset-id2\",\n \"recommendations\": [\n {\n \"id\": \"5ef1fe80f50446b8f41ba691\",\n \"score\": 50\n }\n ]\n }\n]\n```\n\nDataset IDs can be IDs or slugs. Scores should be between `1` and `100`, inclusive. You can validate your JSON using a [JSON Schema](udata_recommendations/schema.json).\n\n[uData]: https://github.com/opendatateam/udata\n[data.gouv.fr]: https://data.gouv.fr\n\n# Changelog\n\n## 3.1.5 (2023-11-21)\n\n- Update Matomo content tracking data-attributes [#263](https://github.com/opendatateam/udata-recommendations/pull/263)\n- Upgrade test and develop dependencies [#264](https://github.com/opendatateam/udata-recommendations/pull/264)\n\n## 3.1.4 (2023-03-07)\n\n- Update and compile translations [#261](https://github.com/opendatateam/udata-recommendations/pull/261) [#262](https://github.com/opendatateam/udata-recommendations/pull/262)\n\n## 3.1.3 (2023-03-02)\n\n- Recommendations for new dataset page [#256](https://github.com/opendatateam/udata-recommendations/pull/256)\n\n## 3.1.2 (2022-12-15)\n\n- Update dataset and reuse recommendations to match new udata-front layout [207](https://github.com/opendatateam/udata-recommendations/pull/207)\n\n## 3.1.1 (2022-09-01)\n\n- Replace mongo legacy image in CI [#226](https://github.com/opendatateam/udata-recommendations/pull/226)\n- Store unique recommendations in extras [#239](https://github.com/opendatateam/udata-recommendations/pull/239)\n\n## 3.1.0 (2021-09-16)\n\n- Change udata-gouvfr dependency to udata-front following renaming [#188](https://github.com/opendatateam/udata-recommendations/pull/188)\n\n## 3.0.0 (2021-08-12)\n\n- Ensure compatibility with udata3 by changing imports and style [#183](https://github.com/opendatateam/udata-recommendations/pull/183)\n\n## 2.2.0 (2020-11-30)\n\n- Add reuses support [#153](https://github.com/opendatateam/udata-recommendations/pull/153)\n\n## 2.1.1 (2020-10-16)\n\n- Ignore recommendation of dataset itself [#147](https://github.com/opendatateam/udata-recommendations/pull/147)\n\n## 2.1.0 (2020-08-25)\n\n- Add score to recommendations and support multiple recommendation sources [#142](https://github.com/opendatateam/udata-recommendations/pull/142)\n\n## 2.0.0 (2020-03-11)\n\n- udata 2.0 / Python 3 support [#95](https://github.com/opendatateam/udata-recommendations/pull/95)\n- Support new hooks format [#96](https://github.com/opendatateam/udata-recommendations/pull/96)\n\n## 1.0.1 (2018-08-03)\n\n- Nothing yet\n\n## 1.0.0 (2018-06-06)\n\n- Allow slug instead of id for datasets [#8](https://github.com/opendatateam/udata-recommendations/pull/8)\n- Initial release\n\n",
"bugtrack_url": null,
"license": "LGPL",
"summary": "uData content recommendations bridge",
"version": "3.1.5",
"project_urls": {
"Homepage": "https://github.com/opendatateam/udata-recommendations"
},
"split_keywords": [
"udata",
"recommendations"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ad2624c342c6249840c2292f62aa858347e125144bed25a7970c9b6403e6cf4",
"md5": "6a1bd523e5a46c5b2c1fd1867839e68e",
"sha256": "03d78bc7cb33747395cbbe2c193b25e7cd49e437c9ff6c260f8a5385b206a69a"
},
"downloads": -1,
"filename": "udata_recommendations-3.1.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "6a1bd523e5a46c5b2c1fd1867839e68e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 14738,
"upload_time": "2023-11-21T10:24:34",
"upload_time_iso_8601": "2023-11-21T10:24:34.652244Z",
"url": "https://files.pythonhosted.org/packages/7a/d2/624c342c6249840c2292f62aa858347e125144bed25a7970c9b6403e6cf4/udata_recommendations-3.1.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-21 10:24:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opendatateam",
"github_project": "udata-recommendations",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"lcname": "udata-recommendations"
}