nips/74.md

103 lines
4.5 KiB
Markdown
Raw Normal View History

# NIP-74
## Enhanced Sorting and Filtering for Social Media Posts
`draft` `optional`
## Abstract
This NIP defines `kind:33031`: a standardized JSON configuration for sorting and filtering social media posts. The configuration allows users to customize how posts are displayed based on various parameters and metadata.
## Motivation
Various NOSTR client frameworks need efficient mechanisms to display relevant posts to users. Sorting and filtering based on user preferences, engagement metrics, and content metadata can enhance the user experience by presenting the most pertinent information. This proposal aims to establish a standard format for configuring such sorting and filtering mechanisms, allowing for "portability" of a users algorithmic preferences across existing clients and any future implementations.
## Specification
The configuration is defined using a JSON object with the following structure:
```json
{
"kind": 33031,
"created_at": 1716994345,
"pubkey": "...",
"id": "...",
"sortingAlgorithmConfig": {
"algorithmName": "EnhancedPostSorter",
"version": "1.0",
"parameters": {
"sortBy": ["timestamp", "engagement", "relevance", "authorInfluence"],
"filters": {
"keywords": ["technology", "science", "sports"],
"language": ["en", "es", "fr"],
"dateRange": {
"startDate": "2023-01-01T00:00:00Z",
"endDate": "2023-12-31T23:59:59Z"
},
"minEngagement": {
"likes": 10,
"retweets": 5,
"comments": 3
},
"userSettings": {
"mutedUsers": ["user123", "user456"],
"blockedUsers": ["user789"],
"preferredAuthors": ["tech_guru", "science_whiz"]
}
},
"metadata": {
"includeRetweets": true,
"includeReplies": false,
"includeMedia": true,
"contentSafety": "safe",
"promotedContent": false
}
}
}
}
```
## Fields
sortingAlgorithmConfig: Root object for the sorting algorithm configuration.
algorithmName: Name of the sorting algorithm.
version: Version of the sorting algorithm.
parameters: Contains sorting and filtering parameters.
sortBy: An array of criteria used for sorting the posts.
filters: Object containing various filters to refine the posts.
keywords: List of keywords to filter the posts.
language: List of languages to include in the posts.
dateRange: Object specifying the start and end dates for filtering posts.
minEngagement: Minimum engagement metrics (likes, retweets, comments) required for the posts.
userSettings: User-specific settings to further filter the posts.
mutedUsers: List of users whose posts should be muted.
blockedUsers: List of users whose posts should be blocked.
preferredAuthors: List of preferred authors whose posts should be prioritized.
metadata: Additional settings for the posts.
includeRetweets: Boolean indicating whether to include retweets.
includeReplies: Boolean indicating whether to include replies.
includeMedia: Boolean indicating whether to include posts with media.
contentSafety: Level of content safety (safe, moderate, any).
promotedContent: Boolean indicating whether to include promoted content.
Rationale
This standardized configuration allows developers and platforms to implement consistent sorting and filtering logic across different social media applications. By using a common format, it becomes easier to integrate and extend sorting algorithms, providing a better user experience.
Compatibility
This proposal is designed to be backward compatible with existing implementations by providing default values for new configuration fields. Platforms can gradually adopt the new configuration format without disrupting current functionality.
## Implementation
To implement this proposal, social media platforms should:
Parse the provided JSON configuration.
Apply sorting and filtering logic based on the specified parameters and metadata.
Ensure that user-specific settings are respected during the sorting and filtering process.
## Conclusion
This NIP provides a structured approach to sorting and filtering social media posts, enhancing user experience through customizable and consistent configurations. Adoption of this standard can lead to improved engagement and satisfaction on social media platforms. One that immediately stands out is encrption/decrpytion of this object at the client as a user's algorithm can be personally identifiable.
This draft can be further refined based on feedback and additional requirements. Let me know if there are specific sections you would like to expand or modify.