GSA / notifications-admin

The UI of Notify.gov
https://notify.gov
Other
11 stars 2 forks source link

API data endpoints for dashboard #1413

Open VRagulina opened 5 months ago

VRagulina commented 5 months ago

The frontend aims to display several features custom to specific resources: user and service name

image

There are 4 distinct features:

  1. Notification stats - For the Service & for an Individual User
  2. recent job activity - For the Service & for an Individual User
  3. templates table - For the Service & for an Individual User
  4. total message allowance

Feature 1: Notification Stats - Activity Snapshot:

At the top of the page, we would like to display a bar chart that allows users to view data from different periods: 7 days30 day period, and 12 month period within a given year.

Each bar will show totals of messages delivered/failed/requested within a given date range and resource.

image image image

Possible endpoints:

curl --location -g '{{base}}/service/{{service_id}}/statistics’

I found this endpoint that provides stats within a given 7 day period, the problem with this endpoint is that it doesn’t provide a daily break down.

{
  "data": {
    "email": {
      "delivered": 0,
      "failure": 0,
      "requested": 0
    },
    "sms": {
      "delivered": 3,
      "failure": 0,
      "requested": 3
    }
  }
}

{{base}}/service/{{service_id}}/notifications/monthly?year=2024 {{base}}/service/monthly-data-by-service?start_date=2024-01-01&end_date=2024-05-31

Feature 2: Job activity:

This feature is similar to the batch jobs that we currently have on display on our current dashboard. Columns: File name, Status, Sender, Service name.

image

Sub feature: Search

I do not believe we currently have an endpoint for search on jobs within service name, all services, or user.

Possible inputs: Users can search by any of the column fields.

image

Sub feature: Pagination

I do not believe we currently have an endpoint for pagination on jobs within service name, all services, or user.

image

Possible endpoint: curl --location --globoff '{{base}}/service/{{service_id}}/job'

Feature 3: Template activity:

This feature pertains to templates. Columns include: Template name, the folder where the templates are located—if they exist—or default to the parent folder, last used, created by, and the count of times the template has been used.

Follow up question: Do we want to count the number of times a template has been used within a specific date range or throughout all time?

image

Possible endpoint: {{base}}/service/{{service_id}}/notifications/templates_usage/monthly?year={{year}} {{base}}/service/{{service_id}}/template-statistics?whole_days=7

Sub feature: Pagination

I do not believe we currently have an endpoint for pagination on jobs within service name, all services, or user.

image

Feature 4: Total Message Allowance:

Lastly, the total message allowance.

Follow-up question: Are the different accounts/resources affected by this total?

image

Possible endpoint: {{base}}/service/{{service_id}}/billing/free-sms-fragment-limit?financial_year_start=2024

Figma: https://www.figma.com/proto/aAWhlPzOP6kfVFnCCAfSZZ/notify.gov?type=design&node-id=3047-6869&t=qTagD5WTtNcuKF7q-0&scaling=scale-down-width&page-id=3047%3A4396&starting-point-node-id=3047%3A4580

em-herrick commented 4 months ago

For each feature we'd like:

To complete a bit of stock-taking research: