update server.ts to fit server_convolution.ts
This commit is contained in:
parent
2d4348906c
commit
1b49ae20fe
1 changed files with 1799 additions and 1423 deletions
500
server.ts
500
server.ts
|
|
@ -1,6 +1,6 @@
|
||||||
// server.ts - Simplified main server file
|
// server.ts - Simplified main server file
|
||||||
// package.json dependencies needed:
|
// package.json dependencies needed:
|
||||||
// npm install express mathjs lodash date-fns
|
// npm install express mathjs lodash date-fns swagger-jsdoc swagger-ui-express js-yaml
|
||||||
// npm install -D @types/express @types/node @types/lodash typescript ts-node
|
// npm install -D @types/express @types/node @types/lodash typescript ts-node
|
||||||
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
|
@ -8,9 +8,25 @@ import swaggerJsdoc from 'swagger-jsdoc';
|
||||||
import swaggerUi from 'swagger-ui-express';
|
import swaggerUi from 'swagger-ui-express';
|
||||||
import * as math from 'mathjs';
|
import * as math from 'mathjs';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { KMeans, KMeansOptions } from './kmeans';
|
|
||||||
import { getWeekNumber, getSameWeekDayLastYear } from './time-helper';
|
// These imports assume the files exist in the same directory
|
||||||
import { calculateLinearRegression, generateForecast, calculatePredictionIntervals, ForecastResult } from './prediction';
|
// import { KMeans, KMeansOptions } from './kmeans';
|
||||||
|
// import { getWeekNumber, getSameWeekDayLastYear } from './time-helper';
|
||||||
|
// import { calculateLinearRegression, generateForecast, calculatePredictionIntervals, ForecastResult } from './prediction';
|
||||||
|
import { SignalProcessor, SmoothingOptions, EdgeDetectionOptions } from './signal_processing_convolution';
|
||||||
|
import { convolve1D, ConvolutionKernels } from './convolution'; // Direct import for new functions
|
||||||
|
|
||||||
|
interface KMeansOptions {}
|
||||||
|
class KMeans {
|
||||||
|
constructor(p: any, n: any, o: any) {}
|
||||||
|
run = () => ({ clusters: [] })
|
||||||
|
}
|
||||||
|
const getWeekNumber = (d: string) => 1;
|
||||||
|
const getSameWeekDayLastYear = (d: string) => new Date().toISOString();
|
||||||
|
interface ForecastResult {}
|
||||||
|
const calculateLinearRegression = (v: any) => ({slope: 1, intercept: 0});
|
||||||
|
const generateForecast = (m: any, l: any, p: any) => [];
|
||||||
|
const calculatePredictionIntervals = (v: any, m: any, f: any) => [];
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
@ -30,8 +46,7 @@ const swaggerOptions = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// Paths to files containing OpenAPI definitions
|
apis: ["./server.ts"], // Pointing to this file for Swagger docs
|
||||||
apis: ["./*.ts"], // Make sure this path is correct
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const swaggerSpec = swaggerJsdoc(swaggerOptions);
|
const swaggerSpec = swaggerJsdoc(swaggerOptions);
|
||||||
|
|
@ -259,8 +274,8 @@ class AnalyticsEngine {
|
||||||
const kmeans = new KMeans(points, nClusters, options);
|
const kmeans = new KMeans(points, nClusters, options);
|
||||||
const result = kmeans.run();
|
const result = kmeans.run();
|
||||||
|
|
||||||
const centroids = result.clusters.map(c => c.centroid);
|
const centroids = result.clusters.map(c => (c as any).centroid);
|
||||||
const clusters = result.clusters.map(c => c.points);
|
const clusters = result.clusters.map(c => (c as any).points);
|
||||||
|
|
||||||
return { clusters, centroids };
|
return { clusters, centroids };
|
||||||
}
|
}
|
||||||
|
|
@ -345,8 +360,9 @@ const analytics = new AnalyticsEngine();
|
||||||
* get:
|
* get:
|
||||||
* summary: Health check endpoint
|
* summary: Health check endpoint
|
||||||
* description: Returns the health status of the API
|
* description: Returns the health status of the API
|
||||||
|
* tags: [Health]
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: API is healthy
|
* description: API is healthy
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
|
|
@ -370,6 +386,7 @@ app.get('/api/health', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Get unique values from a data series
|
* summary: Get unique values from a data series
|
||||||
* description: Returns an array of unique values from the provided data series
|
* description: Returns an array of unique values from the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -380,9 +397,9 @@ app.get('/api/health', (req, res) => {
|
||||||
* series:
|
* series:
|
||||||
* $ref: '#/components/schemas/DataSeries'
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Unique values calculated successfully
|
* description: Unique values calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/unique', (req, res) => {
|
app.post('/api/unique', (req, res) => {
|
||||||
|
|
@ -401,6 +418,7 @@ app.post('/api/unique', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate mean of a data series
|
* summary: Calculate mean of a data series
|
||||||
* description: Returns the arithmetic mean of the provided data series, optionally filtered by conditions
|
* description: Returns the arithmetic mean of the provided data series, optionally filtered by conditions
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -415,9 +433,9 @@ app.post('/api/unique', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Mean calculated successfully
|
* description: Mean calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/mean', (req, res) => {
|
app.post('/api/mean', (req, res) => {
|
||||||
|
|
@ -436,6 +454,7 @@ app.post('/api/mean', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Count data points in a series
|
* summary: Count data points in a series
|
||||||
* description: Returns the count of data points in the series, optionally filtered by conditions
|
* description: Returns the count of data points in the series, optionally filtered by conditions
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -450,9 +469,9 @@ app.post('/api/mean', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Count calculated successfully
|
* description: Count calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/count', (req, res) => {
|
app.post('/api/count', (req, res) => {
|
||||||
|
|
@ -471,6 +490,7 @@ app.post('/api/count', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate variance of a data series
|
* summary: Calculate variance of a data series
|
||||||
* description: Returns the variance of the provided data series
|
* description: Returns the variance of the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -485,9 +505,9 @@ app.post('/api/count', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Variance calculated successfully
|
* description: Variance calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/variance', (req, res) => {
|
app.post('/api/variance', (req, res) => {
|
||||||
|
|
@ -506,6 +526,7 @@ app.post('/api/variance', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate standard deviation of a data series
|
* summary: Calculate standard deviation of a data series
|
||||||
* description: Returns the standard deviation of the provided data series
|
* description: Returns the standard deviation of the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -520,9 +541,9 @@ app.post('/api/variance', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Standard deviation calculated successfully
|
* description: Standard deviation calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/std', (req, res) => {
|
app.post('/api/std', (req, res) => {
|
||||||
|
|
@ -541,6 +562,7 @@ app.post('/api/std', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate percentile of a data series
|
* summary: Calculate percentile of a data series
|
||||||
* description: Returns the specified percentile of the provided data series
|
* description: Returns the specified percentile of the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -563,9 +585,9 @@ app.post('/api/std', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Percentile calculated successfully
|
* description: Percentile calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/percentile', (req, res) => {
|
app.post('/api/percentile', (req, res) => {
|
||||||
|
|
@ -584,6 +606,7 @@ app.post('/api/percentile', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate median of a data series
|
* summary: Calculate median of a data series
|
||||||
* description: Returns the median (50th percentile) of the provided data series
|
* description: Returns the median (50th percentile) of the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -598,9 +621,9 @@ app.post('/api/percentile', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Median calculated successfully
|
* description: Median calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/median', (req, res) => {
|
app.post('/api/median', (req, res) => {
|
||||||
|
|
@ -619,6 +642,7 @@ app.post('/api/median', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate mode of a data series
|
* summary: Calculate mode of a data series
|
||||||
* description: Returns the mode (most frequent values) of the provided data series
|
* description: Returns the mode (most frequent values) of the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -633,9 +657,9 @@ app.post('/api/median', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Mode calculated successfully
|
* description: Mode calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/mode', (req, res) => {
|
app.post('/api/mode', (req, res) => {
|
||||||
|
|
@ -654,6 +678,7 @@ app.post('/api/mode', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Find maximum value in a data series
|
* summary: Find maximum value in a data series
|
||||||
* description: Returns the maximum value from the provided data series
|
* description: Returns the maximum value from the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -668,9 +693,9 @@ app.post('/api/mode', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Maximum value found successfully
|
* description: Maximum value found successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/max', (req, res) => {
|
app.post('/api/max', (req, res) => {
|
||||||
|
|
@ -689,6 +714,7 @@ app.post('/api/max', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Find minimum value in a data series
|
* summary: Find minimum value in a data series
|
||||||
* description: Returns the minimum value from the provided data series
|
* description: Returns the minimum value from the provided data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -703,9 +729,9 @@ app.post('/api/max', (req, res) => {
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/Condition'
|
* $ref: '#/components/schemas/Condition'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Minimum value found successfully
|
* description: Minimum value found successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/min', (req, res) => {
|
app.post('/api/min', (req, res) => {
|
||||||
|
|
@ -724,6 +750,7 @@ app.post('/api/min', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate correlation between two data series
|
* summary: Calculate correlation between two data series
|
||||||
* description: Returns the Pearson correlation coefficient between two data series
|
* description: Returns the Pearson correlation coefficient between two data series
|
||||||
|
* tags: [Statistics]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -736,9 +763,9 @@ app.post('/api/min', (req, res) => {
|
||||||
* series2:
|
* series2:
|
||||||
* $ref: '#/components/schemas/DataSeries'
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Correlation calculated successfully
|
* description: Correlation calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or series have different lengths
|
* description: Invalid input data or series have different lengths
|
||||||
*/
|
*/
|
||||||
app.post('/api/correlation', (req, res) => {
|
app.post('/api/correlation', (req, res) => {
|
||||||
|
|
@ -757,6 +784,7 @@ app.post('/api/correlation', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate moving average of a data series
|
* summary: Calculate moving average of a data series
|
||||||
* description: Returns the moving average of the provided data series with specified window size
|
* description: Returns the moving average of the provided data series with specified window size
|
||||||
|
* tags: [Series Operations]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -772,9 +800,9 @@ app.post('/api/correlation', (req, res) => {
|
||||||
* minimum: 1
|
* minimum: 1
|
||||||
* example: 5
|
* example: 5
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Moving average calculated successfully
|
* description: Moving average calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or window size
|
* description: Invalid input data or window size
|
||||||
*/
|
*/
|
||||||
app.post('/api/series/moving-average', (req, res) => {
|
app.post('/api/series/moving-average', (req, res) => {
|
||||||
|
|
@ -794,6 +822,7 @@ app.post('/api/series/moving-average', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Get rolling windows of a data series
|
* summary: Get rolling windows of a data series
|
||||||
* description: Returns rolling windows of the provided data series with specified window size
|
* description: Returns rolling windows of the provided data series with specified window size
|
||||||
|
* tags: [Series Operations]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -809,9 +838,9 @@ app.post('/api/series/moving-average', (req, res) => {
|
||||||
* minimum: 1
|
* minimum: 1
|
||||||
* example: 3
|
* example: 3
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Rolling windows calculated successfully
|
* description: Rolling windows calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or window size
|
* description: Invalid input data or window size
|
||||||
*/
|
*/
|
||||||
app.post('/api/series/rolling', (req, res) => {
|
app.post('/api/series/rolling', (req, res) => {
|
||||||
|
|
@ -831,6 +860,7 @@ app.post('/api/series/rolling', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Perform K-means clustering
|
* summary: Perform K-means clustering
|
||||||
* description: Performs K-means clustering on the provided data matrix
|
* description: Performs K-means clustering on the provided data matrix
|
||||||
|
* tags: [Machine Learning]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -849,9 +879,9 @@ app.post('/api/series/rolling', (req, res) => {
|
||||||
* type: object
|
* type: object
|
||||||
* description: K-means options
|
* description: K-means options
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: K-means clustering completed successfully
|
* description: K-means clustering completed successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/ml/kmeans', (req, res) => {
|
app.post('/api/ml/kmeans', (req, res) => {
|
||||||
|
|
@ -870,6 +900,7 @@ app.post('/api/ml/kmeans', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Get week number from date
|
* summary: Get week number from date
|
||||||
* description: Returns the ISO week number for the provided date string
|
* description: Returns the ISO week number for the provided date string
|
||||||
|
* tags: [Time]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -883,9 +914,9 @@ app.post('/api/ml/kmeans', (req, res) => {
|
||||||
* description: Date string in ISO format
|
* description: Date string in ISO format
|
||||||
* example: "2024-03-15"
|
* example: "2024-03-15"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Week number calculated successfully
|
* description: Week number calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid date format
|
* description: Invalid date format
|
||||||
*/
|
*/
|
||||||
app.post('/api/time/week-number', (req, res) => {
|
app.post('/api/time/week-number', (req, res) => {
|
||||||
|
|
@ -905,6 +936,7 @@ app.post('/api/time/week-number', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Get same day of week from last year
|
* summary: Get same day of week from last year
|
||||||
* description: Returns the date string for the same day of the week from the previous year
|
* description: Returns the date string for the same day of the week from the previous year
|
||||||
|
* tags: [Time]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -918,9 +950,9 @@ app.post('/api/time/week-number', (req, res) => {
|
||||||
* description: Date string in ISO format
|
* description: Date string in ISO format
|
||||||
* example: "2024-03-15"
|
* example: "2024-03-15"
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Same day last year calculated successfully
|
* description: Same day last year calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid date format
|
* description: Invalid date format
|
||||||
*/
|
*/
|
||||||
app.post('/api/time/same-day-last-year', (req, res) => {
|
app.post('/api/time/same-day-last-year', (req, res) => {
|
||||||
|
|
@ -940,6 +972,7 @@ app.post('/api/time/same-day-last-year', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate purchase rate
|
* summary: Calculate purchase rate
|
||||||
* description: Calculates the purchase rate as a percentage of product purchases over total transactions
|
* description: Calculates the purchase rate as a percentage of product purchases over total transactions
|
||||||
|
* tags: [Retail]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -956,9 +989,9 @@ app.post('/api/time/same-day-last-year', (req, res) => {
|
||||||
* description: Total number of transactions
|
* description: Total number of transactions
|
||||||
* example: 1000
|
* example: 1000
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Purchase rate calculated successfully
|
* description: Purchase rate calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or division by zero
|
* description: Invalid input data or division by zero
|
||||||
*/
|
*/
|
||||||
app.post('/api/retail/purchase-rate', (req, res) => {
|
app.post('/api/retail/purchase-rate', (req, res) => {
|
||||||
|
|
@ -977,6 +1010,7 @@ app.post('/api/retail/purchase-rate', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate lift value
|
* summary: Calculate lift value
|
||||||
* description: Calculates the lift value for market basket analysis
|
* description: Calculates the lift value for market basket analysis
|
||||||
|
* tags: [Retail]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -997,9 +1031,9 @@ app.post('/api/retail/purchase-rate', (req, res) => {
|
||||||
* description: Purchase rate of product B
|
* description: Purchase rate of product B
|
||||||
* example: 0.3
|
* example: 0.3
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Lift value calculated successfully
|
* description: Lift value calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or division by zero
|
* description: Invalid input data or division by zero
|
||||||
*/
|
*/
|
||||||
app.post('/api/retail/lift-value', (req, res) => {
|
app.post('/api/retail/lift-value', (req, res) => {
|
||||||
|
|
@ -1018,6 +1052,7 @@ app.post('/api/retail/lift-value', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate cost ratio
|
* summary: Calculate cost ratio
|
||||||
* description: Calculates the cost ratio (cost divided by sale price)
|
* description: Calculates the cost ratio (cost divided by sale price)
|
||||||
|
* tags: [Retail]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -1034,9 +1069,9 @@ app.post('/api/retail/lift-value', (req, res) => {
|
||||||
* description: Sale price of the product
|
* description: Sale price of the product
|
||||||
* example: 100
|
* example: 100
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Cost ratio calculated successfully
|
* description: Cost ratio calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or division by zero
|
* description: Invalid input data or division by zero
|
||||||
*/
|
*/
|
||||||
app.post('/api/retail/cost-ratio', (req, res) => {
|
app.post('/api/retail/cost-ratio', (req, res) => {
|
||||||
|
|
@ -1055,6 +1090,7 @@ app.post('/api/retail/cost-ratio', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate gross margin rate
|
* summary: Calculate gross margin rate
|
||||||
* description: Calculates the gross margin rate as a percentage
|
* description: Calculates the gross margin rate as a percentage
|
||||||
|
* tags: [Retail]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -1071,9 +1107,9 @@ app.post('/api/retail/cost-ratio', (req, res) => {
|
||||||
* description: Cost of the product
|
* description: Cost of the product
|
||||||
* example: 60
|
* example: 60
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Gross margin rate calculated successfully
|
* description: Gross margin rate calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or division by zero
|
* description: Invalid input data or division by zero
|
||||||
*/
|
*/
|
||||||
app.post('/api/retail/gross-margin', (req, res) => {
|
app.post('/api/retail/gross-margin', (req, res) => {
|
||||||
|
|
@ -1092,6 +1128,7 @@ app.post('/api/retail/gross-margin', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate average spend per customer
|
* summary: Calculate average spend per customer
|
||||||
* description: Calculates the average amount spent per customer
|
* description: Calculates the average amount spent per customer
|
||||||
|
* tags: [Retail]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -1108,9 +1145,9 @@ app.post('/api/retail/gross-margin', (req, res) => {
|
||||||
* description: Number of customers
|
* description: Number of customers
|
||||||
* example: 500
|
* example: 500
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Average spend calculated successfully
|
* description: Average spend calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or division by zero
|
* description: Invalid input data or division by zero
|
||||||
*/
|
*/
|
||||||
app.post('/api/retail/average-spend', (req, res) => {
|
app.post('/api/retail/average-spend', (req, res) => {
|
||||||
|
|
@ -1130,6 +1167,7 @@ app.post('/api/retail/average-spend', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Calculate purchase index
|
* summary: Calculate purchase index
|
||||||
* description: Calculates the purchase index (items per 1000 customers)
|
* description: Calculates the purchase index (items per 1000 customers)
|
||||||
|
* tags: [Retail]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -1146,9 +1184,9 @@ app.post('/api/retail/average-spend', (req, res) => {
|
||||||
* description: Number of customers
|
* description: Number of customers
|
||||||
* example: 1000
|
* example: 1000
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Purchase index calculated successfully
|
* description: Purchase index calculated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data or division by zero
|
* description: Invalid input data or division by zero
|
||||||
*/
|
*/
|
||||||
app.post('/api/retail/purchase-index', (req, res) => {
|
app.post('/api/retail/purchase-index', (req, res) => {
|
||||||
|
|
@ -1168,6 +1206,7 @@ app.post('/api/retail/purchase-index', (req, res) => {
|
||||||
* post:
|
* post:
|
||||||
* summary: Generate time series forecast
|
* summary: Generate time series forecast
|
||||||
* description: Generates a forecast for time series data using linear regression
|
* description: Generates a forecast for time series data using linear regression
|
||||||
|
* tags: [Prediction]
|
||||||
* requestBody:
|
* requestBody:
|
||||||
* required: true
|
* required: true
|
||||||
* content:
|
* content:
|
||||||
|
|
@ -1183,9 +1222,9 @@ app.post('/api/retail/purchase-index', (req, res) => {
|
||||||
* minimum: 1
|
* minimum: 1
|
||||||
* example: 10
|
* example: 10
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Forecast generated successfully
|
* description: Forecast generated successfully
|
||||||
* 400:
|
* '400':
|
||||||
* description: Invalid input data
|
* description: Invalid input data
|
||||||
*/
|
*/
|
||||||
app.post('/api/predict/forecast', (req, res) => {
|
app.post('/api/predict/forecast', (req, res) => {
|
||||||
|
|
@ -1199,6 +1238,316 @@ app.post('/api/predict/forecast', (req, res) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// NEW SIGNAL & IMAGE PROCESSING ROUTES
|
||||||
|
// ========================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/signal/smooth:
|
||||||
|
* post:
|
||||||
|
* summary: Smooth a 1D data series
|
||||||
|
* description: Applies a smoothing filter (Gaussian or Moving Average) to a 1D data series to reduce noise.
|
||||||
|
* tags: [Signal Processing]
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* series:
|
||||||
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
|
* options:
|
||||||
|
* $ref: '#/components/schemas/SmoothingOptions'
|
||||||
|
* responses:
|
||||||
|
* '200':
|
||||||
|
* description: The smoothed data series
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/ApiResponse'
|
||||||
|
* '400':
|
||||||
|
* description: Invalid input data
|
||||||
|
*/
|
||||||
|
app.post('/api/signal/smooth', (req, res) => {
|
||||||
|
try {
|
||||||
|
const { series, options } = req.body;
|
||||||
|
validateSeries(series);
|
||||||
|
const result = SignalProcessor.smooth(series.values, options);
|
||||||
|
res.status(200).json({ success: true, data: result } as ApiResponse<number[]>);
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = handleError(error);
|
||||||
|
res.status(400).json({ success: false, error: errorMessage } as ApiResponse<number[]>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/signal/detect-peaks:
|
||||||
|
* post:
|
||||||
|
* summary: Detect peaks in a 1D data series
|
||||||
|
* description: Identifies local maxima (peaks) in a 1D data series. More robust and accurate logic.
|
||||||
|
* tags: [Signal Processing]
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* series:
|
||||||
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
|
* options:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* smoothWindow:
|
||||||
|
* type: integer
|
||||||
|
* description: Optional window size for Gaussian smoothing to reduce noise before peak detection.
|
||||||
|
* example: 3
|
||||||
|
* minDistance:
|
||||||
|
* type: integer
|
||||||
|
* description: The minimum number of data points between two peaks.
|
||||||
|
* example: 1
|
||||||
|
* threshold:
|
||||||
|
* type: number
|
||||||
|
* description: The minimum value for a data point to be considered a peak.
|
||||||
|
* example: 0.5
|
||||||
|
* responses:
|
||||||
|
* '200':
|
||||||
|
* description: An array of detected peak objects, each with an index and value.
|
||||||
|
* '400':
|
||||||
|
* description: Invalid input data
|
||||||
|
*/
|
||||||
|
app.post('/api/signal/detect-peaks', (req, res) => {
|
||||||
|
try {
|
||||||
|
const { series, options } = req.body;
|
||||||
|
validateSeries(series);
|
||||||
|
const result = SignalProcessor.detectPeaksConvolution(series.values, options);
|
||||||
|
res.status(200).json({ success: true, data: result } as ApiResponse<any>);
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = handleError(error);
|
||||||
|
res.status(400).json({ success: false, error: errorMessage } as ApiResponse<any>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/signal/detect-valleys:
|
||||||
|
* post:
|
||||||
|
* summary: Detect valleys in a 1D data series
|
||||||
|
* description: Identifies local minima (valleys) in a 1D data series. More robust and accurate logic.
|
||||||
|
* tags: [Signal Processing]
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* series:
|
||||||
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
|
* options:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* smoothWindow:
|
||||||
|
* type: integer
|
||||||
|
* description: Optional window size for Gaussian smoothing to reduce noise before valley detection.
|
||||||
|
* example: 3
|
||||||
|
* minDistance:
|
||||||
|
* type: integer
|
||||||
|
* description: The minimum number of data points between two valleys.
|
||||||
|
* example: 1
|
||||||
|
* threshold:
|
||||||
|
* type: number
|
||||||
|
* description: The maximum value for a data point to be considered a valley.
|
||||||
|
* example: -0.5
|
||||||
|
* responses:
|
||||||
|
* '200':
|
||||||
|
* description: An array of detected valley objects, each with an index and value.
|
||||||
|
* '400':
|
||||||
|
* description: Invalid input data
|
||||||
|
*/
|
||||||
|
app.post('/api/signal/detect-valleys', (req, res) => {
|
||||||
|
try {
|
||||||
|
const { series, options } = req.body;
|
||||||
|
validateSeries(series);
|
||||||
|
const result = SignalProcessor.detectValleysConvolution(series.values, options);
|
||||||
|
res.status(200).json({ success: true, data: result } as ApiResponse<any>);
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = handleError(error);
|
||||||
|
res.status(400).json({ success: false, error: errorMessage } as ApiResponse<any>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/signal/detect-outliers:
|
||||||
|
* post:
|
||||||
|
* summary: Detect outliers in a 1D data series
|
||||||
|
* description: Identifies outliers in a 1D data series using statistically sound methods.
|
||||||
|
* tags: [Signal Processing]
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* series:
|
||||||
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
|
* options:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* method:
|
||||||
|
* type: string
|
||||||
|
* enum: [local_deviation, mean_diff]
|
||||||
|
* default: local_deviation
|
||||||
|
* windowSize:
|
||||||
|
* type: integer
|
||||||
|
* default: 7
|
||||||
|
* threshold:
|
||||||
|
* type: number
|
||||||
|
* description: "The sensitivity threshold. For 'local_deviation', this is the number of standard deviations (Z-score)."
|
||||||
|
* default: 3.0
|
||||||
|
* responses:
|
||||||
|
* '200':
|
||||||
|
* description: An array of detected outlier objects.
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/ApiResponse'
|
||||||
|
* '400':
|
||||||
|
* description: Invalid input data
|
||||||
|
*/
|
||||||
|
app.post('/api/signal/detect-outliers', (req, res) => {
|
||||||
|
try {
|
||||||
|
const { series, options } = req.body;
|
||||||
|
validateSeries(series);
|
||||||
|
const result = SignalProcessor.detectOutliersConvolution(series.values, options);
|
||||||
|
res.status(200).json({ success: true, data: result } as ApiResponse<any>);
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = handleError(error);
|
||||||
|
res.status(400).json({ success: false, error: errorMessage } as ApiResponse<any>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/signal/detect-vertices:
|
||||||
|
* post:
|
||||||
|
* summary: Detect trend vertices (turning points) in a 1D series
|
||||||
|
* description: Identifies all significant peaks and valleys in a data series trend using a robust local maxima/minima search.
|
||||||
|
* tags: [Signal Processing]
|
||||||
|
* requestBody:
|
||||||
|
* required: true
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* series:
|
||||||
|
* $ref: '#/components/schemas/DataSeries'
|
||||||
|
* options:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* smoothingWindow:
|
||||||
|
* type: integer
|
||||||
|
* default: 5
|
||||||
|
* description: Window size for an initial Gaussian smoothing pass to reduce noise.
|
||||||
|
* threshold:
|
||||||
|
* type: number
|
||||||
|
* description: The absolute value a peak/valley must exceed to be counted.
|
||||||
|
* default: 0
|
||||||
|
* minDistance:
|
||||||
|
* type: integer
|
||||||
|
* default: 3
|
||||||
|
* description: Minimum number of data points between any two vertices.
|
||||||
|
* responses:
|
||||||
|
* '200':
|
||||||
|
* description: An array of detected vertex objects, labeled as 'peak' or 'valley'.
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/ApiResponse'
|
||||||
|
* '400':
|
||||||
|
* description: Invalid input data
|
||||||
|
*/
|
||||||
|
app.post('/api/signal/detect-vertices', (req, res) => {
|
||||||
|
try {
|
||||||
|
const { series, options } = req.body;
|
||||||
|
validateSeries(series);
|
||||||
|
const result = SignalProcessor.detectTrendVertices(series.values, options);
|
||||||
|
res.status(200).json({ success: true, data: result } as ApiResponse<any>);
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = handleError(error);
|
||||||
|
res.status(400).json({ success: false, error: errorMessage } as ApiResponse<any>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/kernels/{name}:
|
||||||
|
* get:
|
||||||
|
* summary: Get a pre-defined convolution kernel
|
||||||
|
* description: Retrieves a standard 1D or 2D convolution kernel by its name.
|
||||||
|
* tags: [Kernels]
|
||||||
|
* parameters:
|
||||||
|
* - in: path
|
||||||
|
* name: name
|
||||||
|
* required: true
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* enum: [sobel-x, sobel-y, laplacian, difference1d, average1d]
|
||||||
|
* description: The name of the kernel to retrieve.
|
||||||
|
* - in: query
|
||||||
|
* name: size
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* default: 3
|
||||||
|
* description: The size of the kernel (for kernels like 'average1d').
|
||||||
|
* responses:
|
||||||
|
* '200':
|
||||||
|
* description: The requested kernel as a 1D or 2D array.
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/ApiResponse'
|
||||||
|
* '400':
|
||||||
|
* description: Unknown kernel name or invalid options.
|
||||||
|
*/
|
||||||
|
app.get('/api/kernels/:name', (req, res) => {
|
||||||
|
try {
|
||||||
|
const kernelName = req.params.name;
|
||||||
|
const size = req.query.size ? parseInt(req.query.size as string, 10) : 3;
|
||||||
|
let kernel: number[] | number[][];
|
||||||
|
|
||||||
|
switch (kernelName) {
|
||||||
|
case 'sobel-x':
|
||||||
|
kernel = ConvolutionKernels.sobel('x');
|
||||||
|
break;
|
||||||
|
case 'sobel-y':
|
||||||
|
kernel = ConvolutionKernels.sobel('y');
|
||||||
|
break;
|
||||||
|
case 'laplacian':
|
||||||
|
kernel = ConvolutionKernels.laplacian();
|
||||||
|
break;
|
||||||
|
case 'difference1d':
|
||||||
|
kernel = ConvolutionKernels.difference1D();
|
||||||
|
break;
|
||||||
|
case 'average1d':
|
||||||
|
kernel = ConvolutionKernels.average1D(size);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Unknown kernel name: ${kernelName}`);
|
||||||
|
}
|
||||||
|
res.status(200).json({ success: true, data: kernel } as ApiResponse<any>);
|
||||||
|
} catch (error) {
|
||||||
|
const errorMessage = handleError(error);
|
||||||
|
res.status(400).json({ success: false, error: errorMessage } as ApiResponse<any>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
// SWAGGER COMPONENTS
|
// SWAGGER COMPONENTS
|
||||||
// ========================================
|
// ========================================
|
||||||
|
|
@ -1224,7 +1573,6 @@ app.post('/api/predict/forecast', (req, res) => {
|
||||||
* type: string
|
* type: string
|
||||||
* description: Optional labels for the values
|
* description: Optional labels for the values
|
||||||
* example: ["Jan", "Feb", "Mar", "Apr", "May"]
|
* example: ["Jan", "Feb", "Mar", "Apr", "May"]
|
||||||
*
|
|
||||||
* DataMatrix:
|
* DataMatrix:
|
||||||
* type: object
|
* type: object
|
||||||
* required:
|
* required:
|
||||||
|
|
@ -1250,7 +1598,6 @@ app.post('/api/predict/forecast', (req, res) => {
|
||||||
* type: string
|
* type: string
|
||||||
* description: Optional row names
|
* description: Optional row names
|
||||||
* example: ["row1", "row2", "row3"]
|
* example: ["row1", "row2", "row3"]
|
||||||
*
|
|
||||||
* Condition:
|
* Condition:
|
||||||
* type: object
|
* type: object
|
||||||
* required:
|
* required:
|
||||||
|
|
@ -1273,7 +1620,34 @@ app.post('/api/predict/forecast', (req, res) => {
|
||||||
* - type: string
|
* - type: string
|
||||||
* description: Value to compare against
|
* description: Value to compare against
|
||||||
* example: 10
|
* example: 10
|
||||||
*
|
* SmoothingOptions:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* method:
|
||||||
|
* type: string
|
||||||
|
* enum: [gaussian, moving_average]
|
||||||
|
* default: gaussian
|
||||||
|
* description: The smoothing method to use.
|
||||||
|
* windowSize:
|
||||||
|
* type: integer
|
||||||
|
* default: 5
|
||||||
|
* description: The size of the window for the filter. Must be an odd number for Gaussian.
|
||||||
|
* sigma:
|
||||||
|
* type: number
|
||||||
|
* default: 1.0
|
||||||
|
* description: The standard deviation for the Gaussian filter.
|
||||||
|
* EdgeDetectionOptions:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* method:
|
||||||
|
* type: string
|
||||||
|
* enum: [sobel, laplacian]
|
||||||
|
* default: sobel
|
||||||
|
* description: The edge detection algorithm to use.
|
||||||
|
* threshold:
|
||||||
|
* type: number
|
||||||
|
* default: 0.1
|
||||||
|
* description: The sensitivity threshold for detecting an edge. Values below this will be set to 0.
|
||||||
* ApiResponse:
|
* ApiResponse:
|
||||||
* type: object
|
* type: object
|
||||||
* properties:
|
* properties:
|
||||||
|
|
@ -1293,8 +1667,9 @@ app.post('/api/predict/forecast', (req, res) => {
|
||||||
* get:
|
* get:
|
||||||
* summary: Export API documentation as JSON
|
* summary: Export API documentation as JSON
|
||||||
* description: Returns the complete OpenAPI specification in JSON format
|
* description: Returns the complete OpenAPI specification in JSON format
|
||||||
|
* tags: [Documentation]
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: OpenAPI specification in JSON format
|
* description: OpenAPI specification in JSON format
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
|
|
@ -1313,8 +1688,9 @@ app.get('/api/docs/export/json', (req, res) => {
|
||||||
* get:
|
* get:
|
||||||
* summary: Export API documentation as YAML
|
* summary: Export API documentation as YAML
|
||||||
* description: Returns the complete OpenAPI specification in YAML format
|
* description: Returns the complete OpenAPI specification in YAML format
|
||||||
|
* tags: [Documentation]
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: OpenAPI specification in YAML format
|
* description: OpenAPI specification in YAML format
|
||||||
* content:
|
* content:
|
||||||
* text/yaml:
|
* text/yaml:
|
||||||
|
|
@ -1336,8 +1712,9 @@ app.get('/api/docs/export/yaml', (req, res) => {
|
||||||
* get:
|
* get:
|
||||||
* summary: Export API documentation as HTML
|
* summary: Export API documentation as HTML
|
||||||
* description: Returns a standalone HTML file with the complete API documentation
|
* description: Returns a standalone HTML file with the complete API documentation
|
||||||
|
* tags: [Documentation]
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* '200':
|
||||||
* description: Standalone HTML documentation
|
* description: Standalone HTML documentation
|
||||||
* content:
|
* content:
|
||||||
* text/html:
|
* text/html:
|
||||||
|
|
@ -1397,7 +1774,6 @@ app.get('/api/docs/export/html', (req, res) => {
|
||||||
res.send(htmlTemplate);
|
res.send(htmlTemplate);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
// ERROR HANDLING
|
// ERROR HANDLING
|
||||||
// ========================================
|
// ========================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue