npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@akai-mirai/report-ui

v1.0.15

Published

EMS Report UI Library - Beautiful report generation library for quiz and session results

Readme

@ems/report-ui

Beautiful React-based report generation library for quiz and session results. Built with Material-UI and TypeScript.

Features

  • 📊 Quiz Results Reports - Comprehensive analytics for all students
  • 📝 Session Results Reports - Detailed individual student reports
  • 🎨 Beautiful UI - Modern design matching your platform's style
  • 🌍 Internationalization - Support for Kazakh, Russian, and English
  • 📄 PDF Export - Generate PDF reports using Puppeteer
  • 📈 Analytics - Question analysis, subject statistics, and more
  • 🎯 TypeScript - Full type safety

Installation

# Using yarn
yarn add @ems/report-ui

# Using npm
npm install @ems/report-ui

Peer Dependencies

This library requires React and React DOM to be installed in your project:

yarn add react react-dom

Quick Start

import { renderReportToHTML } from '@ems/report-ui'
import type { QuizData, SessionData } from '@ems/report-ui'

// Generate HTML for quiz results report
const html = renderReportToHTML({
  type: 'QUIZ_RESULTS',
  quiz: quizData,
  allSessions: sessionsData,
  options: {
    language: 'ru', // 'kk' | 'ru' | 'en'
    includeProctoring: true,
    includeAiAnalysis: true
  }
})

// Use with Puppeteer to generate PDF
// (see backend integration example)

Usage

Quiz Results Report

import { QuizResultsReportSSR } from '@ems/report-ui'
import { ReportWrapper } from '@ems/report-ui'

function App() {
  return (
    <ReportWrapper>
      <QuizResultsReportSSR
        quiz={quizData}
        allSessions={sessionsData}
        options={{ language: 'ru' }}
      />
    </ReportWrapper>
  )
}

Session Results Report

import { SessionResultsReport } from '@ems/report-ui'
import { ReportWrapper } from '@ems/report-ui'

function App() {
  return (
    <ReportWrapper>
      <SessionResultsReport
        session={sessionData}
        options={{
          language: 'ru',
          includeDetailedAnswers: true,
          includeProctoring: true,
          includeAiAnalysis: true
        }}
      />
    </ReportWrapper>
  )
}

API Reference

Components

QuizResultsReportSSR

Comprehensive quiz results report for teachers.

Props:

  • quiz: QuizData - Quiz data
  • allSessions: SessionData[] - All student sessions
  • options?: ReportGenerationOptions - Report options

SessionResultsReport

Detailed individual session results report.

Props:

  • session: SessionData - Session data with answers
  • options?: ReportGenerationOptions - Report options

ReportWrapper

Theme provider wrapper for reports.

Props:

  • children: React.ReactNode - Report components

Utilities

renderReportToHTML(options)

Renders a report to HTML string for PDF generation.

Parameters:

  • options.type: 'QUIZ_RESULTS' | 'SESSION_RESULTS' - Report type
  • options.quiz?: QuizData - Quiz data (for QUIZ_RESULTS)
  • options.allSessions?: SessionData[] - All sessions (for QUIZ_RESULTS)
  • options.session?: SessionData - Session data (for SESSION_RESULTS)
  • options.options?: ReportGenerationOptions - Report generation options

Returns: string - HTML string

Types

interface QuizData {
  id: string
  title: string
  description?: string
  startTime?: Date | string
  endTime?: Date | string
  duration?: number
  status?: string
  locale?: string
  quizSubjects?: Array<{ subject?: { title: Record<string, string> } }>
  author?: { firstName?: string; lastName?: string; email?: string }
  _count?: { questions: number }
  questions?: Array<{ question: QuestionData }>
}

interface SessionData {
  id: string
  status: string
  score?: number
  correctAnswers?: number
  totalQuestions?: number
  timeSpent?: number
  finishedAt?: Date | string
  startedAt?: Date | string
  user: { firstName?: string; lastName?: string; userName?: string; email?: string }
  quiz?: { title?: string; quizSubjects?: Array<{ subject?: { title: Record<string, string> } }> }
  answers?: AnswerData[]
  proctoringMetrics?: { riskScore?: number }
  proctoringAlerts?: Array<{ severity?: string; type?: string; message?: string; timestamp?: Date | string }>
  aiAnalysis?: { summary?: string; recommendations?: string }
}

interface ReportGenerationOptions {
  includeAiAnalysis?: boolean
  includeProctoring?: boolean
  includeDetailedAnswers?: boolean
  language?: 'kk' | 'ru' | 'en'
  format?: 'PDF' | 'IMAGE'
}

Development

Setup

# Install dependencies
yarn install

# Start dev server (for preview)
yarn dev

# Build library
yarn build:lib

Project Structure

src/
  ├── components/          # React components
  │   ├── QuizResultsReportSSR.tsx
  │   ├── SessionResultsReport.tsx
  │   ├── SubjectStatistics.tsx
  │   └── QuestionAnalysis.tsx
  ├── utils/              # Utilities
  │   ├── render.tsx      # HTML rendering
  │   └── format.ts       # Formatting helpers
  ├── types/              # TypeScript types
  ├── theme/              # Material-UI theme
  ├── i18n/               # Internationalization
  └── index.ts            # Main entry point

Backend Integration

See INTEGRATION_GUIDE.md for detailed backend integration instructions.

Example with NestJS:

import { renderReportToHTML } from '@ems/report-ui'
import puppeteer from 'puppeteer'

async function generatePDF(quizData: QuizData, sessions: SessionData[]) {
  const html = renderReportToHTML({
    type: 'QUIZ_RESULTS',
    quiz: quizData,
    allSessions: sessions,
    options: { language: 'ru' }
  })

  const browser = await puppeteer.launch()
  const page = await browser.newPage()
  await page.setContent(html)
  const pdf = await page.pdf({ format: 'A4' })
  await browser.close()

  return pdf
}

License

MIT

Support

For issues and questions, please contact the EMS team.