Lawful Basis Tracker
Track and document the lawful basis for every data processing activity under NDPA 2023
Overview
The Lawful Basis Tracker component helps organisations identify, document, and maintain records of the lawful basis for each data processing activity. Under the Nigeria Data Protection Act 2023 (NDPA), every processing of personal data must be grounded in a valid lawful basis as defined in Section 25.
NDPA Section 25 — Lawful Basis for Processing
The NDPA 2023 requires that personal data shall only be processed if at least one of the following applies: consent of the data subject, performance of a contract, compliance with a legal obligation, protection of vital interests, performance of a task carried out in the public interest, or legitimate interests of the controller (subject to the rights of the data subject).
Installation
Install the NDPR Toolkit package which includes the Lawful Basis Tracker components:
pnpm add @tantainnovative/ndpr-toolkitProduction Readiness
Use this checklist when moving Lawful Basis Tracker from demo mode into a customer-facing workflow. Pair the UI package with the source templates in @tantainnovative/ndpr-recipes so validation, persistence, and audit behavior live in your own backend.
Implementation checklist
- Require a lawful basis for every processing purpose before the activity goes live.
- Record consent, contract, legal obligation, vital interest, public task, or legitimate interest rationale.
- Link each activity to retention, data categories, recipients, DPIA needs, and ROPA records.
- Review legitimate-interest activities for balancing-test evidence and objection handling.
- Define review cadence and owners for stale, archived, or changed processing activities.
Backend notes
- Use the recipes Drizzle adapter as the persistence reference for lawful-basis records.
- Run validateProcessingActivity in create/update handlers before records become active.
- Store supporting rationale and review dates separately from display labels so evidence survives copy edits.
- Keep consent-dependent activities linked to the consent system rather than duplicating preference state.
Testing notes
- Create activities for each lawful basis and verify summaries and compliance gaps.
- Submit missing purpose, missing basis, and incomplete legitimate-interest records to validation.
- Archive a basis and confirm dependent ROPA or dashboard summaries update correctly.
- Verify users without privacy/legal permissions cannot approve or modify legal rationale.
Common mistakes
- Using consent as the default basis when contract, legal obligation, or legitimate interest is the real basis.
- Recording only the basis label without the purpose, necessity, and evidence behind it.
- Leaving activities active after the product feature, vendor, or processing purpose changed.
- Letting engineering-only owners approve legal basis changes without privacy review.
Import
Import from the main package:
import { LawfulBasisTracker, useLawfulBasis } from '@tantainnovative/ndpr-toolkit';
// Utility functions
import {
validateProcessingActivity,
getLawfulBasisDescription,
assessComplianceGaps,
generateLawfulBasisSummary,
} from '@tantainnovative/ndpr-toolkit';Components
The Lawful Basis Tracker provides a component and hook for managing lawful basis records:
LawfulBasisTracker
A comprehensive component for tracking and documenting the lawful basis for each data processing activity. It provides a UI for adding, editing, and reviewing processing activities with their associated lawful basis.
import { LawfulBasisTracker, useLawfulBasis } from '@tantainnovative/ndpr-toolkit';
function LawfulBasisPage() {
const { activities, addActivity, updateActivity, archiveActivity } = useLawfulBasis();
return (
<LawfulBasisTracker
activities={activities}
onAdd={addActivity}
onUpdate={updateActivity}
onArchive={archiveActivity}
/>
);
}API Reference
LawfulBasisTracker Props
| Prop | Type | Default | Description |
|---|---|---|---|
| activities | ProcessingActivity[] | Required | List of processing activities to display |
| onAdd | (activity: Omit<ProcessingActivity, 'id' | 'createdAt' | 'updatedAt'>) => void | undefined | Callback when a new activity is created |
| onUpdate | (id: string, updates: Partial<ProcessingActivity>) => void | undefined | Callback when an activity is updated |
| onArchive | (id: string) => void | undefined | Callback when an activity is archived |
| title | string | "Lawful Basis Tracker" | Title displayed on the tracker |
| description | string | NDPA Section 25 default | Description text displayed on the tracker |
| className | string | undefined | Custom CSS class for the tracker container |
| buttonClassName | string | undefined | Custom CSS class for buttons |
| showSummary | boolean | true | Whether to show the compliance summary at the top |
| showComplianceGaps | boolean | true | Whether to show compliance gap alerts |
| classNames | LawfulBasisTrackerClassNames | undefined | Override class names for individual sections; takes priority over className / buttonClassName |
| unstyled | boolean | undefined | When true, all default styling is removed so consumers can style from scratch using classNames |
Lawful Basis Types
// The six lawful bases for processing personal data per NDPA Section 25(1)
type LawfulBasis =
| 'consent' // Section 25(1)(a)
| 'contract' // Section 25(1)(b)
| 'legal_obligation' // Section 25(1)(c)
| 'vital_interests' // Section 25(1)(d)
| 'public_interest' // Section 25(1)(e)
| 'legitimate_interests'; // Section 25(1)(f)
interface ProcessingActivity {
id: string;
name: string;
description: string;
lawfulBasis: LawfulBasis;
lawfulBasisJustification: string;
dataCategories: string[];
involvesSensitiveData: boolean;
sensitiveDataCondition?: SensitiveDataCondition;
dataSubjectCategories: string[];
purposes: string[];
retentionPeriod: string;
retentionJustification?: string;
recipients?: string[];
crossBorderTransfer: boolean;
createdAt: number;
updatedAt: number;
reviewDate?: number;
status: 'active' | 'inactive' | 'under_review' | 'archived';
dpoApproval?: {
approved: boolean;
approvedBy: string;
approvedAt: number;
notes?: string;
};
}Lite variant (read-only)
For read-only surfaces such as dashboards and audit pages, use LawfulBasisTrackerLite from the new /lawful-basis/lite subpath. It renders the same list-and-summary view as the Full component without any Add, Edit, Archive, or CSV-export affordances — and ships at 12.7 KB instead of 36.7 KB (a 65% saving, minified and pre-gzip).
import { LawfulBasisTrackerLite } from '@tantainnovative/ndpr-toolkit/lawful-basis/lite';
<LawfulBasisTrackerLite
activities={activities}
onActivityClick={(activity) => router.push(`/lawful-basis/${activity.id}`)}
/>See the Lite vs Full Managers guide for migration notes, side-by-side examples, and the full bundle-size table.
Best Practices
- Assess Before Processing: Determine and document the lawful basis before starting any new processing activity.
- Review Regularly: Periodically review lawful basis assessments, especially when the nature of processing changes.
- Be Specific: Do not rely on a blanket lawful basis for all activities; each processing purpose should have its own documented basis.
- Consent as Last Resort: Where another lawful basis applies, consider using it instead of consent, as consent can be withdrawn at any time.
- Keep Records: Maintain audit trails of all assessments for regulatory accountability under the NDPA.