Discriminator is a technical validation service designed to analyze interior design data. It evaluates spatial layouts against a set of predefined rules covering capacity, zoning, ergonomics, visual aesthetics, and physical geometry.
# Install dependencies
npm install
# Start the production server
npm start
# Start the development server with hot-reload
npm run dev
# Run the test suite
npm test
# Run typecheck
npm run typecheck
| Endpoint | Method | Description |
|---|---|---|
| / | GET | HTML rendering of this README file. |
| /api/v2/ | GET | Health check and version metadata. |
| /api/v2/validate | POST | Primary validation endpoint. Runs all rules. |
| /api/v2/zone | POST | Dedicated endpoint for automatic zone detection logic. |
| /api/v2/path | POST | Dedicated endpoint for pathfinding and clearance calculation. |
0 being the floor level).position coordinates (x, z) represent the horizontal center of the object, while y represents the bottom of the object.X = 0 and Z = 0, with the floor at Y = 0.-x/2 to +x/2 (relative to position.x), from -z/2 to +z/2 (relative to position.z), and from 0 to y (relative to position.y).roomData.objects)lang property.0.type Point = [number, number];
type Position = { x: number; y: number; z: number };
type RGB = { r: number; g: number; b: number };
type ValidationRequest = {
lang: 'en' | 'cs';
roomData: {
size: Position;
objects: Array<{
id: string;
name: string;
categoryId: string;
position: Position;
size: Position;
rotation: number;
colors: RGB[];
designStyle: string[];
material: string[];
seatingCapacity: number;
zoneId: null | string;
isDominant: boolean;
isZoneDev: boolean;
isBorder: boolean;
}>;
};
questionnaire: {
numberOfAdults: number;
numberOfChildren: number;
numberOfGuests: number;
workplace: boolean;
playground: boolean;
};
zones: null | Array<{ id: string; polygon: Point[] }>;
paths: null | Array<{ objectIdFrom: string; objectIdTo: string; points: Point[] }>;
};
Standard successful response.
type ValidateResult = {
executionTime: number;
summary: {
totalRules: number;
passed: number;
failed: number;
warnings: number;
passRate: number;
overallStatus: 'pass' | 'fail' | 'warning';
};
zones: Array<{ id: string; polygon: Point[] }>;
paths: Array<{ objectIdFrom: string; objectIdTo: string; points: Point[] }>;
results: Array<{
status: 'pass' | 'warning' | 'fail';
ruleId: string;
userMessage: string;
userRepairInstructions?: string; // only for fail and warning
impactedObjectId?: string;
measuredValue?: number;
errorValue?: number;
}>;
};
Returned when the request data fails schema validation.
{
"error": "Invalid request",
"message": "Detailed validation error message"
}
Returned when an unexpected error occurs during processing.
{
"error": "Internal Server Error",
"message": "Detailed error message"
}
The engine processes all objects with a zoneId. The room's total area is partitioned into specific polygons based on the distribution of these anchored objects.
The algorithm generates a movement graph based on: