Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions app/api/compliance/sections/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,22 @@ export async function GET(request: NextRequest) {
throw sectionsError;
}

// Exclude intro sections (sections ending in .1) from the main list
// Exclude intro sections (sections ending in .1 titled "General" or "Scope")
// These are section group introductions that will be shown contextually
// Pattern matches: 11B-203.1, 11B-404.2.1, etc.
// We identify them by title rather than depth, as some .1 sections at any depth
// may be titled "General" (intro) while others have specific titles (real requirements)
filteredSections = filteredSections.filter((section: any) => {
const parts = section.number.split(/[.-]/);
return parts[parts.length - 1] !== '1';
// Only filter sections ending in .1
if (!section.number.endsWith('.1')) {
return true;
}

// Check if this is an intro section by title
const titleClean = (section.title || '').trim().replace(/\.$/, '').toLowerCase();
const isIntroSection = titleClean === 'general' || titleClean === 'scope';

// Keep all non-intro sections, exclude intro sections
return !isIntroSection;
});

// Format sections for frontend consumption
Expand Down
Loading