Add comprehensive documentation for employee learning platform

- Created handover document outlining design decisions and application functionality.
- Developed implementation plan detailing phased approach for service development.
- Specified ingestion service responsibilities, API surface, and processing pipeline.
This commit is contained in:
RaymondVerhoef
2026-05-23 15:38:09 +02:00
parent 881148357e
commit dda20612e9
32 changed files with 3519 additions and 573 deletions

View File

@@ -0,0 +1,76 @@
import 'dotenv/config';
import { QdrantClient } from '@qdrant/js-client-rest';
// ---------------------------------------------------------------------------
// Env validation
// ---------------------------------------------------------------------------
const QDRANT_URL = process.env['QDRANT_URL'] ?? '';
const QDRANT_API_KEY = process.env['QDRANT_API_KEY'] ?? '';
if (!QDRANT_URL) {
console.error('Missing env var: QDRANT_URL');
process.exit(1);
}
// ---------------------------------------------------------------------------
// Collection definitions
// ---------------------------------------------------------------------------
const VECTOR_SIZE = 1536; // text-embedding-3-small
const DISTANCE = 'Cosine' as const;
const COLLECTIONS = [
{
name: 'source_chunks',
// Payload indices for R42 context-weighted retrieval (boost by theme_id)
payloadIndices: ['theme_id', 'topic_id', 'source_document_id', 'format'],
},
{
name: 'topic_summaries',
payloadIndices: ['theme_id', 'topic_id'],
},
] as const;
// ---------------------------------------------------------------------------
// Setup
// ---------------------------------------------------------------------------
async function run(): Promise<void> {
console.log('Connecting to Qdrant...');
const client = new QdrantClient({
url: QDRANT_URL,
...(QDRANT_API_KEY ? { apiKey: QDRANT_API_KEY } : {}),
});
const { collections } = await client.getCollections();
const existingNames = new Set(collections.map(c => c.name));
for (const col of COLLECTIONS) {
if (existingNames.has(col.name)) {
console.log(` skip ${col.name}`);
continue;
}
await client.createCollection(col.name, {
vectors: { size: VECTOR_SIZE, distance: DISTANCE },
});
console.log(` create ${col.name}`);
// Keyword payload indices for efficient filtering
for (const field of col.payloadIndices) {
await client.createPayloadIndex(col.name, {
field_name: field,
field_schema: 'keyword',
});
console.log(` index ${col.name}.${field}`);
}
}
console.log('\nDone.');
}
run().catch((err: unknown) => {
console.error('Qdrant setup failed:', err);
process.exit(1);
});