- audit-inflection-point.js: Identify fictional content in research paper - fix-inflection-point-fiction.js: Remove fabricated statistics - audit-all-card-sequences.js: Check card sequence quality - audit-card-category-sequences.js: Analyze pedagogical flow - resequence-cards-pedagogically.js: Reorder cards for better learning flow - apply-production-fixes.js: Production deployment script - inspect-*: Helper scripts for analysis Quality improvements: - Removed fictional content from Inflection Point document (3 sections) - Resequenced 21 documents pedagogically (22-67% jumpiness reduction) - Implemented proper learning flow: concepts → warnings → technical → reference
133 lines
5 KiB
JavaScript
133 lines
5 KiB
JavaScript
/**
|
|
* Audit card sequences for ALL public documents
|
|
* Identify poor/dumb sequences
|
|
*/
|
|
const { MongoClient } = require('mongodb');
|
|
|
|
const PUBLIC_SLUGS = [
|
|
'introduction', 'core-concepts', 'executive-summary-tractatus-inflection-point',
|
|
'implementation-guide-v1.1', 'implementation-guide', 'implementation-guide-python-examples',
|
|
'tractatus-framework-research', 'pluralistic-values-research-foundations',
|
|
'the-27027-incident-a-case-study-in-pattern-recognition-bias',
|
|
'real-world-ai-governance-a-case-study-in-framework-failure-and-recovery',
|
|
'llm-integration-feasibility-research-scope',
|
|
'research-topic-concurrent-session-architecture',
|
|
'research-topic-rule-proliferation-transactional-overhead',
|
|
'technical-architecture', 'api-reference-complete', 'api-javascript-examples',
|
|
'api-python-examples', 'openapi-specification',
|
|
'value-pluralism-faq', 'tractatus-ai-safety-framework-core-values-and-principles',
|
|
'organizational-theory-foundations', 'business-case-tractatus-framework'
|
|
];
|
|
|
|
async function run() {
|
|
const client = new MongoClient('mongodb://localhost:27017');
|
|
await client.connect();
|
|
|
|
const db = client.db('tractatus_dev');
|
|
const collection = db.collection('documents');
|
|
|
|
console.log('═══════════════════════════════════════════════════════════');
|
|
console.log(' CARD SEQUENCE AUDIT - ALL PUBLIC DOCUMENTS');
|
|
console.log('═══════════════════════════════════════════════════════════\n');
|
|
|
|
const issues = [];
|
|
|
|
for (const slug of PUBLIC_SLUGS) {
|
|
const doc = await collection.findOne({ slug });
|
|
|
|
if (!doc) {
|
|
console.log(`⚠️ NOT FOUND: ${slug}\n`);
|
|
continue;
|
|
}
|
|
|
|
console.log(`\n📄 ${doc.title}`);
|
|
console.log(` Slug: ${slug}`);
|
|
console.log(` Category: ${doc.category || 'none'}`);
|
|
|
|
if (!doc.sections || doc.sections.length === 0) {
|
|
console.log(` ❌ NO CARDS - Document has no sections!`);
|
|
issues.push({ slug, issue: 'No cards/sections' });
|
|
continue;
|
|
}
|
|
|
|
console.log(` Cards: ${doc.sections.length}`);
|
|
|
|
// Check card sequence quality
|
|
const cardIssues = [];
|
|
|
|
// Check for duplicate numbers
|
|
const numbers = doc.sections.map(s => s.number);
|
|
const duplicates = numbers.filter((n, i) => numbers.indexOf(n) !== i);
|
|
if (duplicates.length > 0) {
|
|
cardIssues.push(`Duplicate card numbers: ${duplicates.join(', ')}`);
|
|
}
|
|
|
|
// Check for missing numbers (gaps)
|
|
const maxNum = Math.max(...numbers);
|
|
for (let i = 1; i <= maxNum; i++) {
|
|
if (!numbers.includes(i)) {
|
|
cardIssues.push(`Missing card number: ${i}`);
|
|
}
|
|
}
|
|
|
|
// Check for poor titles
|
|
doc.sections.forEach((section, idx) => {
|
|
if (!section.title || section.title.length < 3) {
|
|
cardIssues.push(`Card ${section.number}: Title too short/empty`);
|
|
}
|
|
|
|
if (section.title.length > 100) {
|
|
cardIssues.push(`Card ${section.number}: Title too long (${section.title.length} chars)`);
|
|
}
|
|
|
|
// Check for generic/dumb titles
|
|
const dumbTitles = ['Section', 'Part', 'Chapter', 'Introduction', 'Overview', 'Summary'];
|
|
if (dumbTitles.some(dt => section.title === dt)) {
|
|
cardIssues.push(`Card ${section.number}: Generic title "${section.title}"`);
|
|
}
|
|
|
|
// Check for empty content
|
|
if (!section.content_html || section.content_html.trim().length < 10) {
|
|
cardIssues.push(`Card ${section.number}: Empty or minimal content`);
|
|
}
|
|
|
|
// Check category validity
|
|
const validCategories = ['conceptual', 'technical', 'critical', 'practical', 'reference'];
|
|
if (!validCategories.includes(section.category)) {
|
|
cardIssues.push(`Card ${section.number}: Invalid category "${section.category}"`);
|
|
}
|
|
});
|
|
|
|
if (cardIssues.length > 0) {
|
|
console.log(` ⚠️ ISSUES:`);
|
|
cardIssues.forEach(issue => console.log(` - ${issue}`));
|
|
issues.push({ slug, issues: cardIssues });
|
|
} else {
|
|
console.log(` ✅ Card sequence looks good`);
|
|
}
|
|
}
|
|
|
|
console.log('\n\n═══════════════════════════════════════════════════════════');
|
|
console.log(' SUMMARY');
|
|
console.log('═══════════════════════════════════════════════════════════\n');
|
|
|
|
console.log(`Documents audited: ${PUBLIC_SLUGS.length}`);
|
|
console.log(`Documents with issues: ${issues.length}\n`);
|
|
|
|
if (issues.length > 0) {
|
|
console.log('Issues found:\n');
|
|
issues.forEach(item => {
|
|
console.log(`${item.slug}:`);
|
|
if (item.issue) {
|
|
console.log(` - ${item.issue}`);
|
|
} else {
|
|
item.issues.forEach(issue => console.log(` - ${issue}`));
|
|
}
|
|
console.log('');
|
|
});
|
|
}
|
|
|
|
await client.close();
|
|
}
|
|
|
|
run().catch(console.error);
|