Published March 25, 2026 | Version v3

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 four files: the tool source code (reg2req.zip), all pipeline outputs, ground truth datasets, and user study materials (data.zip), the complete set of LLM prompts used across all pipeline stages and supporting features (feature_prompts.xlsx), and the annotation guidelines (Annotation Guidelines.zip).

File Overview

File Description
reg2req.zip Complete Reg2Req source code
data.zip Pipeline outputs, ground truth datasets, and user study materials
feature_prompts.xlsx LLM prompt reference table
Annotation Guidelines.zip Annotation guidelines for requirement-bearing clause identification and human evaluation of requirement derivation and explanation generation

1. reg2req.zip - Tool Source Code

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 - 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

4. Annotation Guidelines.zip - Annotation Guidelines

This folder contains two files containing annotation guidelines for the two stages of the pipeline: Stage 1 defines the decision procedure for classifying clauses as requirement-bearing or not, and Stage 2 provides the rubric-anchored evaluation criteria (correctness, clarity, and completeness on a 1–5 scale) used by annotators to assess the pipeline's derived requirements and explanations.

Files

Annotation Guidelines.zip

Files (4.0 MB)

Name Size Download all
md5:d00af27a11be71046bd9295e5331e14e
4.2 kB Preview Download
md5:ba3f9e1e6421f401ecae217247a3925e
2.3 MB Preview Download
md5:58913fe36873e81074f8f7ff8bb3cd25
10.8 kB Download
md5:d7830644d04c88904d0bb797137320d6
1.7 MB Preview Download