--- action.py
+++ action.py
... | ... | @@ -1,7 +1,7 @@ |
1 | 1 |
import psycopg2 |
2 | 2 |
from flask_restx import Resource, Api, Namespace, fields |
3 | 3 |
from flask import request |
4 |
-from flask import Flask, render_template, request, jsonify, Response |
|
4 |
+from flask import Flask, render_template, request, jsonify, Response, marshal_with |
|
5 | 5 |
from flask_restful import reqparse |
6 | 6 |
from statsmodels.tsa.statespace.sarimax import SARIMAX |
7 | 7 |
from datetime import datetime, timedelta |
... | ... | @@ -163,6 +163,23 @@ |
163 | 163 |
return df |
164 | 164 |
|
165 | 165 |
|
166 |
+resource_fields = { |
|
167 |
+ 'welding_job_number': fields.Integer, |
|
168 |
+ 'mold_name': fields.String, |
|
169 |
+ 'work_start_time': fields.DateTime, |
|
170 |
+ 'defect_status': fields.String, |
|
171 |
+ 'temperature': fields.Float, |
|
172 |
+ 'relative_humidity': fields.Float, |
|
173 |
+ 'absolute_humidity': fields.Float |
|
174 |
+} |
|
175 |
+ |
|
176 |
[email protected]('/Request_Manufacturing_Data') |
|
177 |
+class ManufacturingData(Resource): |
|
178 |
+ @marshal_with(resource_fields) |
|
179 |
+ def get(self): |
|
180 |
+ return get_manufacturing_data().to_dict(orient="records") |
|
181 |
+ |
|
182 |
+ |
|
166 | 183 |
@Action.route('/correlation') |
167 | 184 |
class Correlation(Resource): |
168 | 185 |
@Action.doc(responses={200: 'Success'}) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?