Spaces:
Running
Running
| /** | |
| * Schema Loader Utility | |
| * कार्य: Dataset metadata fetch & validation | |
| */ | |
| class SchemaLoader { | |
| constructor() { | |
| this.schemaUrl = 'https://huggingface.co/datasets/kalpesh77/vedic-neural-geometry/resolve/main/SCHEMA.json'; | |
| this.schema = null; | |
| this.isLoaded = false; | |
| } | |
| async load() { | |
| if (this.isLoaded) return this.schema; | |
| try { | |
| console.log('📥 SCHEMA.json fetch सुरू...'); | |
| const response = await fetch(this.schemaUrl); | |
| if (!response.ok) throw new Error(`HTTP ${response.status}: Schema fetch failed`); | |
| this.schema = await response.json(); | |
| this.isLoaded = true; | |
| console.log('✅ SCHEMA.json यशस्वी लोड'); | |
| return this.schema; | |
| } catch (error) { | |
| console.error('❌ Schema Loader त्रुटी:', error); | |
| throw error; | |
| } | |
| } | |
| getCoordinateConfig() { | |
| if (!this.isLoaded) throw new Error('Schema अजून लोड झालेले नाही'); | |
| const nodeSchema = this.schema.canonical.nodes.columns; | |
| return { | |
| xColumn: 'x', | |
| yColumn: 'y', | |
| sourceRange: { min: 0, max: 1000 }, | |
| targetRange: { min: 0, max: 100 }, | |
| scaleFactor: 0.1, // 100 / 1000 | |
| typeColumn: 'type', | |
| idColumn: 'node_id' | |
| }; | |
| } | |
| } | |
| window.VedicSchemaLoader = new SchemaLoader(); |