docs/architecture/templates-and-dashboards.md

Templates And Dashboards

This slice covers reusable manual-entry templates and user-defined dashboards.

Template Management

flowchart LR
    subgraph UI["UI"]
        MENU["Templates menu"]
        EDITOR["TemplateEditor"]
        DRAWER["Type-specific element drawer"]
        CANVAS["Blank canvas"]
    end

    subgraph API["REST API Gateway"]
        LISTDOSE["POST /dose/elements/list"]
        LISTTEST["POST /test/elements/list"]
        LISTTEMPLATE["POST /user/template"]
        SAVETEMPLATE["POST /user/template/save"]
        DELETETEMPLATE["POST /user/template/delete"]
    end

    subgraph Lambdas["Lambdas"]
        L_DOSE["dose-list-dose-elements"]
        L_TEST["test-list-test-elements"]
        L_LIST["user-entry-template-list"]
        L_SAVE["user-entry-template-save"]
        L_DELETE["user-entry-template-delete"]
    end

    subgraph Data["DynamoDB"]
        DOSEE["env-dose-element"]
        TESTE["env-test-element"]
        TEMPLATE["env-user-entry-template"]
    end

    MENU --> EDITOR
    EDITOR --> DRAWER
    DRAWER --> LISTDOSE --> L_DOSE --> DOSEE
    DRAWER --> LISTTEST --> L_TEST --> TESTE
    EDITOR --> LISTTEMPLATE --> L_LIST --> TEMPLATE
    CANVAS --> SAVETEMPLATE --> L_SAVE --> TEMPLATE
    EDITOR --> DELETETEMPLATE --> L_DELETE --> TEMPLATE

Template Consumers

flowchart TB
    TEMPLATE["env-user-entry-template"] --> TEST["Manual test add/edit"]
    TEMPLATE --> DOSE["Dose history add/edit"]
    TEMPLATE --> PROGRAM["Program history add/edit"]

    TEST --> TESTSAVE["POST /test/history/save"]
    DOSE --> DOSESAVE["POST /dose/history/save"]
    PROGRAM --> PROGSAVE["POST /program/history/save"]

Dashboard Management

flowchart LR
    subgraph UI["UI"]
        HOME["Home dashboard"]
        DASHEDIT["Dashboard editor"]
        DRAWER["Test picker drawer"]
        CARD["Custom chart card"]
        RAW["Raw data modal"]
    end

    subgraph API["REST API Gateway"]
        LISTDASH["POST /user/dashboard"]
        SAVEDASH["POST /user/dashboard/save"]
        DELETEDASH["POST /user/dashboard/delete"]
        LISTTEST["POST /test/elements/list"]
        LISTDOSE["POST /dose/elements/list"]
        LISTTESTH["POST /test/history/list"]
        LISTDOSEH["POST /dose/history/list"]
    end

    subgraph Lambdas["Lambdas"]
        L_LISTDASH["user-dashboard-list"]
        L_SAVEDASH["user-dashboard-save"]
        L_DELETEDASH["user-dashboard-delete"]
        L_LISTTEST["test-list-test-elements"]
        L_LISTDOSE["dose-list-dose-elements"]
        L_LISTTESTH["test-list-test-history"]
        L_LISTDOSEH["dose-list-dose-history"]
    end

    subgraph Data["DynamoDB"]
        DASH["env-user-dashboard"]
        TESTE["env-test-element"]
        DOSEE["env-dose-element"]
        TESTH["env-test-history"]
        DOSEH["env-dose-history"]
    end

    HOME --> LISTDASH --> L_LISTDASH --> DASH
    DASHEDIT --> LISTDASH
    DASHEDIT --> DRAWER --> LISTTEST --> L_LISTTEST --> TESTE
    CARD --> LISTDOSE --> L_LISTDOSE --> DOSEE
    DASHEDIT --> SAVEDASH --> L_SAVEDASH --> DASH
    DASHEDIT --> DELETEDASH --> L_DELETEDASH --> DASH
    HOME --> LISTTESTH --> L_LISTTESTH --> TESTH
    HOME --> LISTDOSEH --> L_LISTDOSEH --> DOSEH
    CARD --> RAW

Notes

  • Templates are scoped by user, tank, and template type: Test, Dose, or Program.
  • Dashboards are scoped by user and tank.
  • Basic users can save one dashboard per tank; Pro users can save unlimited dashboards.
  • Dashboard custom charts select a measured test element and up to two dose elements.
  • Chart clicks can navigate to the relevant test-history or dose-history record.