untitled-group/kanbasu

Tracking issue for activities streamlined view

skyzh opened this issue · 0 comments

skyzh commented

Our activities page should be a concise and informative calendar, like the one in Things 3. To achieve this, we need to

  • get information from activity stream
  • extract keywords from activity stream, by using NLP-like or regex methods
  • implement more APIs, and get detailed information from REST (or buffer) APIs
  • make a function Metadata getMetadata(ActivityItem item, CanvasBufferApi api), which extracts necessary information from item.

For example, there could be

    {
        "created_at": "2021-03-19T02:43:18Z",
        "updated_at": "2021-03-19T02:43:18Z",
        "id": 5710310,
        "title": "作业已创建 - Q4-1, 应用软件课程设计",
        "message": "          \n已为您的课程创建了新作业,应用软件课程设计。\n\nQ4-1\n\n\n\n截止日期:没有截止日期\n单击此处查看作业:\nhttps://oc.sjtu.edu.cn/courses/30514/assignments/92902\n\n\n\n\n\n\n          ________________________________________\n\n          您收到此电子邮件的原因是您使用 Canvas 参加了一个或多个课程。要更改或关闭电子邮件通知,请访问:⏎ https://oc.sjtu.edu.cn/profile/communication\n\n",
        "type": "Message",
        "read_state": true,
        "context_type": "Course",
        "course_id": 30514,
        "message_id": null,
        "notification_category": "Due Date",
        "url": "https://oc.sjtu.edu.cn/courses/30514/assignments/92902",
        "html_url": "https://oc.sjtu.edu.cn/courses/30514/assignments/92902"
    },

In this message, we could not directly get course, assignment name and deadline from JSON fields. We need to extract from plain text messages, and get course information by initiating another api request.

The metadata API should return something like this:

Date, Time, 软件工程 · 作业已评分 · 95/100 · (Mr. Yu: 很好)
Date, Time, 软件工程 · 作业已发布 · xxxxx

Which contains necessary information to get full view of an event.