Skip to content

dwp/dwp-ask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DWP Ask Frontend

DWP Ask is an AI-powered policy search and question-answering application that helps DWP staff quickly find accurate information from policy documents. The frontend provides an intuitive chat interface for users to interact with the AI system and access policy information efficiently.

Table of Contents

Overview

The DWP Ask frontend is a Next.js 15 application built with React 19 and TypeScript. It provides a modern, accessible, and responsive user interface that integrates with Azure OpenAI services and Azure AI Search to deliver intelligent policy search capabilities.

Key Features

πŸ€– AI-Powered Chat Interface

  • Interactive chat interface for natural language policy queries
  • Real-time streaming responses from Azure OpenAI (GPT-4o)
  • Follow-up question suggestions based on context
  • Query refinement and elaboration capabilities

πŸ“š Policy Search & Discovery

  • Semantic search across DWP policy documents
  • Source citations with direct links to policy documents
  • Document download functionality
  • Advanced search filtering and pagination

πŸ‘₯ User Management & Analytics

  • Role-based access control (Admin, User)
  • User group management and permissions
  • Comprehensive analytics and usage tracking
  • Message history and conversation management

πŸ“Š Administrative Features

  • Admin dashboard for system monitoring
  • Feedback collection and management
  • CSV export functionality for data analysis
  • User activity and query analytics

β™Ώ Accessibility & Compliance

  • GOV.UK Design System compliance
  • WCAG 2.1 AA accessibility standards
  • Screen reader compatibility
  • Keyboard navigation support

πŸ“± Responsive Design

  • Mobile-first responsive design
  • Progressive Web App (PWA) capabilities
  • Cross-browser compatibility
  • Optimized performance

Technology Stack

  • Framework: Next.js 15 (App Router)
  • Frontend: React 19, TypeScript
  • Styling: SCSS, GOV.UK Frontend 5.13
  • State Management: React Context API
  • Testing: Jest, React Testing Library
  • Code Quality: Biome, Husky
  • Analytics: Google Tag Manager integration
  • Security: Content Security Policy, DOMPurify

Project Structure

app/
β”œβ”€β”€ (pages)/                 # Route groups
β”‚   β”œβ”€β”€ accessibility/       # Accessibility statement
β”‚   β”œβ”€β”€ admin/              # Admin dashboard
β”‚   β”œβ”€β”€ ai-notice/          # AI usage notice
β”‚   β”œβ”€β”€ chat/               # Main chat interface
β”‚   └── feedback/           # Feedback forms
β”œβ”€β”€ api/                    # API routes
β”‚   β”œβ”€β”€ query/              # Search queries
β”‚   β”œβ”€β”€ feedback/           # Feedback handling
β”‚   β”œβ”€β”€ messages/           # Message management
β”‚   └── download/           # File downloads
β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”œβ”€β”€ Analytics/          # Analytics components
β”‚   β”œβ”€β”€ Answer/             # AI response display
β”‚   β”œβ”€β”€ ChatInput/          # Chat input interface
β”‚   β”œβ”€β”€ Layout/             # Page layouts
β”‚   β”œβ”€β”€ Navbar/             # Navigation
β”‚   └── Shared/             # Common components
β”œβ”€β”€ hooks/                  # Custom React hooks
β”œβ”€β”€ providers/              # Context providers
β”œβ”€β”€ types/                  # TypeScript definitions
β”œβ”€β”€ utils/                  # Utility functions
└── constants/              # Application constants

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Access to DWP Ask backend services
  • Environment variables (contact a-cubed group maintainers)

Installation

  1. Clone the repository:
git clone <repository-url>
cd a-cubed-new-frontend
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env-example .env
  1. Contact the a-cubed group maintainers to obtain the required environment variables for your .env file.

  2. Start the development server:

npm run dev
  1. Open http://localhost:3000 in your browser.

HTTPS Development (Optional)

For testing with HTTPS locally:

npm run dev:https

Environment Configuration

The application requires several environment variables. Contact the a-cubed group maintainers to obtain the necessary values:

NEXT_PUBLIC_BASE_URL=         # Backend API URL
NEXT_PUBLIC_APP_URL=          # Frontend application URL
ACCESS_TOKEN=                 # API access token
NODE_ENV=                     # Environment (development/production)
NEXT_PUBLIC_MAX_ROW_CSV=      # CSV export row limit

Available Scripts

Development

  • npm run dev - Start development server
  • npm run dev:https - Start development server with HTTPS
  • npm run build - Build production application
  • npm run start - Start production server

Code Quality

  • npm run lint - Run Biome
  • npm run type-check - Run TypeScript type checking
  • npm run format - Format code with Biome

Testing

  • npm run test - Run tests
  • npm run test:watch - Run tests in watch mode
  • npm run test:coverage - Run tests with coverage report
  • npm run test:notest - Pass with no tests (for CI)

Development Workflow

Pre-commit Hooks

The project uses Husky for pre-commit hooks that automatically run:

  • Code formatting check (Biome)
  • Linting (Biome)
  • Type checking
  • Tests
  • Commit message validation

Commit Message Format

Follow conventional commit format:

feat: A new feature
fix: A bug fix
docs: Documentation only changes
style: Changes that do not affect the meaning of the code
refactor: A code change that neither fixes a bug nor adds a feature
perf: A code change that improves performance
test: Adding missing tests or correcting existing tests
build: Changes that affect the build system or external dependencies
ci: Changes to our CI configuration files and scripts
chore: Other changes that don't modify source or test files

Testing

The project uses Jest and React Testing Library for testing:

  • Unit Tests: Component and utility function tests
  • Integration Tests: API route and user interaction tests
  • Coverage Reports: Available in coverage/ directory

Run tests with:

npm run test:coverage

Deployment

The application is deployed using GitLab CI/CD pipelines:

  1. Development: Automatic deployment on merge to develop
  2. Test: Deployment to test environment
  3. Production: Manual deployment from main branch

Docker

The application includes a Dockerfile for containerized deployment:

docker build -t dwp-ask-frontend .
docker run -p 3000:3000 dwp-ask-frontend

Contributing

  1. Create a feature branch from develop
  2. Make your changes following the coding standards
  3. Ensure all tests pass and pre-commit hooks succeed
  4. Submit a merge request with a clear description
  5. Request review from team members

Code Standards

  • Use TypeScript for all new code
  • Follow React best practices and hooks patterns
  • Maintain accessibility standards (WCAG 2.1 AA)
  • Write comprehensive tests for new features
  • Document complex functionality

Architecture Patterns

  • Component Structure: Use functional components with hooks
  • State Management: Context API for global state, local state for components
  • API Integration: Custom hooks for data fetching
  • Error Handling: Comprehensive error boundaries and user feedback
  • Performance: Code splitting, lazy loading, and optimization

Support

For technical support or questions:

  • Contact the a-cubed group maintainers for environment variables and access
  • Refer to the DWP Ask documentation for system overview

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors