윤영준 윤영준 2023-10-22
made manufacturing data DB interaction
@27b8ef168f5d682349ea80cc2ad4477b89b89d17
action.py
--- action.py
+++ action.py
@@ -1,7 +1,7 @@
 import psycopg2
 from flask_restx import Resource, Api, Namespace, fields
 from flask import request
-from flask import Flask, render_template, request, jsonify, Response
+from flask import Flask, render_template, request, jsonify, Response, marshal_with
 from flask_restful import reqparse
 from statsmodels.tsa.statespace.sarimax import SARIMAX
 from datetime import datetime, timedelta
@@ -163,6 +163,23 @@
     return df
 
 
+resource_fields = {
+    'welding_job_number': fields.Integer,
+    'mold_name': fields.String,
+    'work_start_time': fields.DateTime,
+    'defect_status': fields.String,
+    'temperature': fields.Float,
+    'relative_humidity': fields.Float,
+    'absolute_humidity': fields.Float
+}
+
[email protected]('/Request_Manufacturing_Data')
+class ManufacturingData(Resource):
+    @marshal_with(resource_fields)
+    def get(self):
+        return get_manufacturing_data().to_dict(orient="records")
+
+
 @Action.route('/correlation')
 class Correlation(Resource):
     @Action.doc(responses={200: 'Success'})
Add a comment
List