There is a newer version of the record available.

Published March 15, 2026 | Version v1

From Regulation to Requirements: An Automated Requirement Derivation and Explanation Pipeline

  • 1. TCS Research

Description

This repository contains the replication package and source code for the tool Reg2Req, accompanying the paper titled 'From Regulation to Requirements: An Automated Requirement Derivation and Explanation Pipeline'. The deposit consists of three files: the tool source code (reg2req.zip), all pipeline outputs, ground truth datasets, and user study materials (data.zip), and the complete set of LLM prompts used across all pipeline stages and supporting features (feature_prompts.xlsx).

File Overview

File Size Description
reg2req.zip 1.77 MB Complete Reg2Req source code
data.zip 2.30 MB Pipeline outputs, ground truth datasets, and user study materials
feature_prompts.xlsx 8.33 KB LLM prompt reference table

1. reg2req.zip — Tool Source Code

Unzips to a reg2req/ folder. Requires Python 3.9+ and an OpenAI API key to run the live pipeline. 

Module Structure

Module Description
app.py Streamlit application with five tabs: Clauses, Requirements, Definitions, Traceability Matrix, Export
pipeline/preprocessor.py Stage 0: Parses EUR-Lex HTML into Clause objects
pipeline/identifier.py Stage 1: GPT-5 clause identification with justification
pipeline/derivator.py Stage 2: GPT-5 requirement derivation with explanations and cross-references
tools/classifier.py FR/NFR classification
tools/usecase.py Use case seed generation
tools/definitions.py Term definition extraction
tools/traceability.py Bidirectional traceability matrix builder
utils/config.py Configuration loaded from environment variables
utils/loader.py Loads pre-computed outputs from data/ when no API key is present
utils/export.py Multi-sheet Excel export of all pipeline outputs
models/clause.py Clause dataclass
models/requirement.py Requirement and CrossReference dataclasses

Running the Application

 

cd reg2req
pip install -r requirements.txt

# Optional: set API key to run the live pipeline
echo "OPENAI_API_KEY=sk-..." > .env

# Launch the Streamlit app
streamlit run app.py

 

Detailed instructions are provided in the README.MD file in the reg2req\ folder. Without an API key, the application automatically switches to Load from Excel mode and serves the pre-computed results.

2. data.zip — Pre-Computed Pipeline Outputs and Datasets

Unzips to a data/ folder with seven subfolders. ClauseID follows the format <REGULATION>-<Article>-<Clause> (e.g., GDPR-5-1, EUAI-10-3). Full requirement IDs are constructed as <ClauseID>-<RequirementID> (e.g., GDPR-5-1-R2).

1. data/clauses/

Raw parsed clauses extracted from EUR-Lex HTML.

Files: gdpr_clauses.xlsx, euai_clauses.xlsx

2. data/clause_identification/

GPT-5 predictions and human-annotated ground truth for requirement-bearing clause identification.

Files: gdpr_requirement_bearing_pred.xlsx, euai_requirement_bearing_pred.xlsx, gdpr_requirement_bearing_ground_truth.xlsx, euai_requirement_bearing_ground_truth.xlsx

3. data/requirement_derivation/

Derived requirements with plain-language explanations, typed cross-references, and LLM-as-judge evaluation scores.

Files: gdpr_derived_requirements_with_refs.xlsx, euai_derived_requirements_with_refs.xlsx, gdpr_llm_judge_results.xlsx, euai_llm_judge_results.xlsx

4. data/FR_NFR_classification/

GPT-5 FR/NFR predictions and human-annotated ground truth labels.

Files: gdpr_FR_NFR_pred.xlsx, euai_FR_NFR_pred.xlsx, gdpr_FR_NFR_ground_truth.xlsx, euai_FR_NFR_ground_truth.xlsx

5. data/use_case_seeds/

GPT-5-generated partial use case seeds for each derived requirement.

Files: GDPR_use_cases.xlsx, EUAI_use_cases.xlsx

6. data/definitions/

Regulatory term definitions extracted by GPT-5 from all clauses, in both Excel and JSON formats.

Files: gdpr_definitions.xlsx, gdpr_definitions.json, euai_definitions.xlsx, euai_definitions.json

7. data/user study/

User study materials for RQ4 and RQ5.

Files: Reg2Req User Study - Google Forms.pdf (complete questionnaire as administered), Reg2Req User Study (Responses).xlsx (anonymised participant responses, n = 25)

Timestamps, tool names, and any potentially identifying content in free-text responses have been redacted.

3. feature_prompts.xlsx — Prompt Reference Table

An Excel file listing the system prompt and user prompt template used in each pipeline stage and supporting feature.

Columns: Feature, System Prompt, User Prompt

Files

data.zip

Files (4.1 MB)

Name Size Download all
md5:ac4772d5f9604c2fe5072a6c59415800
2.3 MB Preview Download
md5:f20dcde202a63ac86f15ebdbeb8e3030
8.3 kB Download
md5:6ece74510273111b1a0a34f03379aee3
1.8 MB Preview Download