This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Collector Service

Collector Service - Dịch vụ thu thập dữ liệu


{ { < svg “content/docs/services/collector/img/overview.svg” > } } TODO: mo ta

Tính năng

  1. Thu thập dữ liệu, dịch vụ hỗ trợ các phương thức thu thập dữ liệu sau
    1. Hỗ trợ API thu thập dữ liệu, phương pháp này hỗ trợ thu thập dữ liệu thông qua internet với bộ API được quy định sẵn.
    2. Hỗ trợ thu thập dữ liệu bằng tin nhắn SMS
  2. Hỗ trợ các tính năng quản lý dự án thu thập dữ liệu:
    1. Quản lý biểu mẫu thu thập dữ liệu
    2. Quản lý người tham gia và người nhập liệu theo nhóm
  3. Hỗ trợ nhắc nhở nhập liệu bằng SMS

Thu thập dữ liệu bằng tin nhắn SMS

Phương pháp này hỗ trợ người dùng nhập dữ liệu từ tin nhắn SMS

  • Yêu cầu

    • Một header nhắn tin phải được quy định trước
    • Số điện thoại của người dùng phải tồn tại trong cơ sơ dữ liệu của hệ thống
  • Cơ chế hoạt động

{{ < svg “content/docs/services/collector/img/sms_parser.svg” > }}

Triển khai

Sơ đồ triển khai

deployment

Collector Service cần có các thành phần sau khi triển để hoạt động đầy đủ chức năng:

  1. PostgreSQL: là thành phần quan trọng nhất, dùng để lưu trữ mọi dữ liệu của dịch vụ
  2. Identity Management Service: dùng để lưu trữ định danh người dùng (hiện chưa hỗ trợ)
  3. SMS Service: dùng để nhắc nhở nhập dữ liệu và nhận dữ liệu từ SMS
  4. Analysis Service: dùng để ??? (TODO: bổ sung)

Mở rộng (scaling)

Application Deployment Model: Stateless scaling

Tăng số lượng node để tăng khả năng chịu tài và độ ổn định của dịch vụ

Access Control Policies

1 - Access Control

Best Practices[1]

Scope the Organization Name

A rule of thumb is to prefix resource names with a domain that represents the organization creating the software.

  • KHÔNG DÙNG: <some-id>
  • DÙNG: <organizaion-id>:<some-id>

Scope Actions, Resources and Subjects

It is wise to scope actions, resources, and subjects in order to prevent name collisions:

  • KHÔNG DÙNG: myorg.com:<subject-id>, myorg.com:<resource-id>, myorg.com:<action-id>
  • DÙNG: myorg.com:subjects:<subject-id>, myorg.com:resources:<resource-id>, myorg.com:actions:<action-id>
  • DÙNG: subjects:myorg.com:<subject-id>, resources:myorg.com:<resource-id>, actions:myorg.com:<action-id>

Multi-Tenant Systems

Multi-tenant systems typically have resources which should not be access by other tenants in the system. This can be achieved by adding the tenant id to the URN:

Do: resources:myorg.com:tenants:<tenant-id>:<resource-id> In some environments, it is common to have organizations and projects belonging to those organizations. Here, the following URN semantics can be used:

Do: resources:myorg.com:organizations:<organization-id>:projects:<project-id>:<resource-id>

Hiện thực

Subject

Users

Các thuộc tính dùng để phân quyền của Users

{
    id: string
    role: string // role của service là admin hoặc user
}

Resources

Dịch vụ Collector gồm có các loại resource sau:

  • Project
{
    id: string
}
  • ProjectUserGroup
{
    id: string
    ProjectId: string
}
  • Form
{
    id: string
}
  • Section
{
    id: string
}
  • FormSection (section thuộc một form cụ thể)
{
    id: string
    FormId: string
}

Chính sách truy cập

Gồm có 3 loại chính sách:

  • Chính sách hệ thống (áp dụng trên mức hệ thống - Ưu tiên cao nhất)
  • Chính sách dịch vụ (áp dụng tại dịch vụ - Ưu tiên cao)
  • Chính sách dự án (áp dụng trong dự án, được PROJECT OWNER quy định để phù hợp với nghiệp vụ của mình)

Chính sách hệ thống (#TODO dẫn nguồn)

Chính sách dịch vụ

Là các chính sách áp dụng trong Collector Service:

  1. PROJECT OWNER có toàn quyền trong dự án của mình
[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub == r.obj.Owner
  1. RESEARCHER có quyền XEM{Thông tin dự án, thành viên trong dự án}
[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub.role == reseacher
  1. RESEARCHER có quyền XEM, THÊM dữ liệu
[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub.role == reseacher

Tài liệu tham khảo

[1] ORY Access Control Policies