{
  "meta": {
    "project": "SAWIS BI",
    "date": "2026-02-21",
    "prepared_by": "Generated by TestSprite"
  },
  "product_overview": "SAWIS BI is a React frontend for exploring wine industry data (export reports, grape production, vineyard status) with enhanced tabs and filters; logged-in users get value/currency views, price-range comparisons, generated reports and admin tools.",
  "core_goals": [
    "Provide interactive Export Reports with filterable charts and tables (Overview, Volume/Value, Price Range, Generated Reports).",
    "Allow exploration and export of pivot reports for Grape Production and Vineyard Status with sidebar filters and GenericPivotTable generation.",
    "Support authenticated features: value/currency data, price-range comparisons (up to 5), generated report exports, and admin mapper/import tools.",
    "Maintain a simple public experience for anonymous users while enabling additional capabilities after login (auto-login from cookies)."
  ],
  "features": [
    {
      "name": "Home navigation",
      "description": "Landing page that shows a banner and three navigation cards linking to the main report sections.",
      "user_flows": [
        "Navigate to / -> See banner and three navigation cards -> Click Export Reports card -> Navigate to /reports -> See Export Reports layout",
        "Navigate to / -> See banner and three navigation cards -> Click Grape Production card -> Navigate to /grape-production -> See Grape Production sidebar and report list",
        "Navigate to / -> See banner and three navigation cards -> Click Vineyard Status card -> Navigate to /vineyard-status -> See Vineyard Status sidebar and report list",
        "Navigate to / -> See banner and three navigation cards -> Click Export Reports card -> Navigate to /reports -> Click a navigation card but page fails to load -> See error message 'Failed to load page'"
      ]
    },
    {
      "name": "Login",
      "description": "Sign in via the navbar modal using email, password and reCAPTCHA; accept the disclaimer to complete session and set cookies.",
      "user_flows": [
        "Navigate to / -> Click Login in navbar to open modal -> Fill email input -> Fill password input -> Complete reCAPTCHA -> Click Sign In -> See Disclaimer modal -> Click Accept -> See navbar show user name and logged-in state",
        "Navigate to / -> Click Login in navbar to open modal -> Fill email input -> Fill wrong password -> Complete reCAPTCHA -> Click Sign In -> See error message 'Invalid credentials' -> Remain in Login modal"
      ]
    },
    {
      "name": "Logout",
      "description": "Sign out from the navbar user menu; confirm sign out in a modal which clears session cookies.",
      "user_flows": [
        "Be logged in on any route -> Click user name/icon in navbar -> See Sign Out confirmation modal -> Click Yes -> See navbar show Login -> Confirm cookies cleared",
        "Be logged in on any route -> Click user name/icon in navbar -> See Sign Out confirmation modal -> Click Yes -> Sign out request fails -> See error message 'Sign out failed' -> Stay logged in"
      ]
    },
    {
      "name": "Export Reports - Overview",
      "description": "Overview tab shows charts (export by product type, over time, cultivar, top 25) and responds to sidebar filters.",
      "user_flows": [
        "Navigate to /reports -> Ensure Overview tab is active -> See charts for export by product type, exports over time, cultivar, top 25 -> Open sidebar filters -> Set filters -> Click Apply -> See charts update",
        "Navigate to /reports -> Ensure Overview tab is active -> Open sidebar filters -> Set filters -> Click Apply -> Backend request fails -> See error message 'Failed to fetch overview data'"
      ]
    },
    {
      "name": "Export Reports - Volume / Value",
      "description": "Volume/Value tab shows volume-only tables for anonymous users and volume+value with currency when logged in; supports sidebar filters and table views.",
      "user_flows": [
        "Navigate to /reports -> Switch to Volume/Value tab -> See volume-only tables (anonymous) -> Open sidebar filters -> Set filters -> Click Apply -> See volume tables update",
        "Navigate to /reports -> Switch to Volume/Value tab as logged-in user -> See tables with volume and value (currency) -> Open sidebar filters -> Set filters -> Click Apply -> See tables update",
        "Navigate to /reports -> Switch to Volume/Value tab (anonymous) -> Attempt to view currency values or switch to Value tab -> See prompt 'Log in to compare volume data with currencies'"
      ]
    },
    {
      "name": "Export Reports - Price Range",
      "description": "Price Range tab (logged-in only) lets users create and compare up to 5 price-range tables by country and filters.",
      "user_flows": [
        "Be logged in -> Navigate to /reports -> Switch to Price Range tab -> Click Create (price range form) -> Fill price-range criteria -> Click Add/Create -> See new price range table added -> Repeat up to 5 to compare tables",
        "Navigate to /reports as anonymous -> Attempt to switch to Price Range tab -> See prompt 'Log in to compare price ranges for exports' -> Unable to create price-range tables"
      ]
    },
    {
      "name": "Export Reports - Generated Reports",
      "description": "Generated Reports tab (logged-in only) presents a table of generated reports with year/group selectors, refresh, and Excel export.",
      "user_flows": [
        "Be logged in -> Navigate to /reports -> Switch to Reports tab -> Select year and groups -> Click Refresh -> See generated reports table populate -> Click Export to Excel -> Download generated Excel file",
        "Navigate to /reports as anonymous -> Attempt to access Reports tab -> Tab is not visible or see prompt to log in -> Cannot view generated reports"
      ]
    },
    {
      "name": "Grape Production",
      "description": "List of grape production pivot reports with sidebar filters; each report item can generate a pivot table based on selected filters and be exported.",
      "user_flows": [
        "Navigate to /grape-production -> See sidebar filters -> Set filters (year, selections) -> Click Apply -> See report list updated -> Select report item -> Click Generate Report -> See pivot table populate -> Click Export -> Download report",
        "Navigate to /grape-production -> Set filters -> Click Generate Report on an item -> Backend returns no data -> See message 'No data available for selected filters'"
      ]
    },
    {
      "name": "Vineyard Status",
      "description": "Vineyard status pivot reports mirror the Grape Production pattern: filter in sidebar, generate pivot tables, and export results.",
      "user_flows": [
        "Navigate to /vineyard-status -> See sidebar filters -> Set filters -> Click Apply -> See report list -> Select report item -> Click Generate Report -> See pivot table populate -> Click Export -> Download file",
        "Navigate to /vineyard-status -> Set filters -> Click Generate Report -> API request fails -> See error 'Failed to fetch report data'"
      ]
    },
    {
      "name": "Admin - Mapper Import Prepper & Lookups",
      "description": "Admin-only area for managing mapper import history, uploading mapper files via an upload wizard, and CRUD on lookup entities.",
      "user_flows": [
        "Be logged in as admin -> Navigate to /admin -> Click Mapper Import Prepper -> See mapper processing history table -> Click Upload -> Open Upload Import Wizard -> Select .xlsx file -> Click Upload -> See processing status and result -> Click View on a history row -> See file process details modal",
        "Be logged in as admin -> Navigate to /admin -> Click Mapper Lookups -> Click Add -> Fill lookup form -> Click Save -> See new lookup row in table",
        "Be not admin -> Navigate to /admin -> Attempt to access admin route -> See redirect to / or 'Access denied' message"
      ]
    }
  ],
  "code_summary": {
    "version": "2",
    "type": "frontend",
    "tech_stack": [
      "JavaScript",
      "React 18",
      "React Router 6",
      "Bootstrap / Reactstrap",
      "Zustand",
      "ECharts"
    ],
    "routes": [
      {
        "path": "/",
        "file": "src/pages/Home.js",
        "auth_required": false,
        "description": "Home landing with navigation to Export Reports, Grape Production, Vineyard Status"
      },
      {
        "path": "/reports",
        "file": "src/pages/Reports.js",
        "auth_required": false,
        "description": "Export Reports with Overview, Volume/Value, Value (login prompt when anonymous), Price Range, Reports tabs"
      },
      {
        "path": "/grape-production",
        "file": "src/pages/GrapeProduction.js",
        "auth_required": false,
        "description": "Grape Production pivot reports with sidebar filters"
      },
      {
        "path": "/vineyard-status",
        "file": "src/pages/VineyardStatus.js",
        "auth_required": false,
        "description": "Vineyard Status pivot reports with sidebar filters"
      }
    ],
    "features": [
      {
        "name": "Home navigation",
        "description": "View home page and navigate to Export Reports, Grape Production, Vineyard Status",
        "files": [
          "src/pages/Home.js",
          "src/AppRoutes.js"
        ],
        "entry_route": "/",
        "user_interactions": [
          "See banner and three navigation cards",
          "Click Export Reports to go to /reports",
          "Click Grape Production to go to /grape-production",
          "Click Vineyard Status to go to /vineyard-status"
        ],
        "api_calls": [],
        "auth_required": false
      },
      {
        "name": "Login",
        "description": "Sign in via navbar modal with email, password, reCAPTCHA; accept disclaimer to complete session",
        "files": [
          "src/store/authStore.js",
          "src/components/forms/LoginForm.jsx",
          "src/components/Navbar.js"
        ],
        "entry_route": "/",
        "user_interactions": [
          "Click Login in navbar to open modal",
          "Fill email input",
          "Fill password input",
          "Complete reCAPTCHA",
          "Click Sign In",
          "Accept disclaimer to complete login"
        ],
        "api_calls": [
          {
            "method": "POST",
            "endpoint": "loginAuth"
          }
        ],
        "auth_required": false
      },
      {
        "name": "Logout",
        "description": "Sign out via navbar user menu; confirm in modal",
        "files": [
          "src/store/authStore.js",
          "src/components/Navbar.js"
        ],
        "entry_route": "/",
        "user_interactions": [
          "Click user name/icon in navbar",
          "Confirm sign out in modal (Yes)"
        ],
        "api_calls": [],
        "auth_required": true
      },
      {
        "name": "Export Reports Overview",
        "description": "View Overview tab charts (export by product type, over time, cultivar, top 25)",
        "files": [
          "src/pages/Reports.js",
          "src/components/tabs/Overview.jsx",
          "src/store/filterStore.js"
        ],
        "entry_route": "/reports",
        "user_interactions": [
          "Open Export Reports",
          "Ensure Overview tab is active",
          "View charts; optionally set sidebar filters and Apply"
        ],
        "api_calls": [],
        "auth_required": false
      },
      {
        "name": "Export Reports Volume and Value",
        "description": "View Volume/Value tables; when logged in see value/currency; when anonymous see volume only",
        "files": [
          "src/pages/Reports.js",
          "src/components/tabs/Tables.jsx",
          "src/store/filterStore.js"
        ],
        "entry_route": "/reports",
        "user_interactions": [
          "Open Export Reports and switch to Volume/Value tab",
          "Optionally apply sidebar filters",
          "View tables (and value when logged in)"
        ],
        "api_calls": [],
        "auth_required": false
      },
      {
        "name": "Export Reports Price Range",
        "description": "Create and compare up to 5 price range tables (logged-in only)",
        "files": [
          "src/pages/Reports.js",
          "src/components/tabs/PricesRanges.jsx",
          "src/store/priceRangeStore.js"
        ],
        "entry_route": "/reports",
        "user_interactions": [
          "Be logged in; open Export Reports",
          "Switch to Price Range tab",
          "Create price range tables and compare"
        ],
        "api_calls": [],
        "auth_required": true
      },
      {
        "name": "Export Reports Generated Reports",
        "description": "View and export generated reports table (logged-in only)",
        "files": [
          "src/pages/Reports.js",
          "src/components/tabs/GeneratedReports.jsx",
          "src/store/filterStore.js"
        ],
        "entry_route": "/reports",
        "user_interactions": [
          "Be logged in; open Export Reports",
          "Switch to Reports tab",
          "Select year/groups, refresh, export to Excel"
        ],
        "api_calls": [],
        "auth_required": true
      },
      {
        "name": "Grape Production",
        "description": "View grape production report list; apply filters and generate pivot tables",
        "files": [
          "src/pages/GrapeProduction.js",
          "src/store/grapeProductionStore.js"
        ],
        "entry_route": "/grape-production",
        "user_interactions": [
          "Open Grape Production from Home or nav",
          "Set sidebar filters and Apply",
          "Select report item and Generate Report",
          "View table and export options"
        ],
        "api_calls": [],
        "auth_required": false
      },
      {
        "name": "Vineyard Status",
        "description": "View vineyard status report list; apply filters and generate pivot tables",
        "files": [
          "src/pages/VineyardStatus.js",
          "src/store/vineyardStatusStore.js"
        ],
        "entry_route": "/vineyard-status",
        "user_interactions": [
          "Open Vineyard Status from Home or nav",
          "Set sidebar filters and Apply",
          "Select report item and Generate Report",
          "View table and export options"
        ],
        "api_calls": [],
        "auth_required": false
      }
    ],
    "known_limitations": []
  }
}
