def delete(self):
        try:
            DB_query.delete(insurance_damage)
            return {"result": "Successfully deleted"}

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
    def put(self, damage_id):
        try:
            DB_query.put(damage_id, insurance_damage)
            return {"status": 'success'}

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
    def put(self, id):
        try:
            DB_query.put(id, vehicle_type)
            return {"status": 'success'}

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
    def put(self, id):
        try:
            DB_query.put(id, external_status_config)
            return {"status": 'success'}

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
    def get(self):

        try:

            results = DB_query.get(insurance_partdamage)
            # print("results--------",results)
            response = {}

            for index, res in enumerate(results):
                response[index] = {
                    "id": res.id,
                    "side": res.side,
                    "ref_num": res.ref_num,
                    "part_name": res.part_name,
                    "coordinates": res.coordinates,
                    "picture": res.picture,
                    "intensity": res.intensity,
                    "created_at": str(res.created_at),
                    "updated_at": str(res.updated_at),
                    "part_id": res.part_id,
                    "vehicle_id": res.vehicle_id,
                    "file_name": res.file_name,
                    "is_fp": res.is_fp,
                    "source_name": res.source_name
                }

            return jsonify(response)

        except Exception as e:
            return {"error": str(e)}
    def get(self):

        try:
            results = DB_query.getFromVehicle(insurance_vehicle, "7")
            response = {}

            for index, res in enumerate(results):
                response[index] = {
                    "id": res.id,
                    "ref_num": res.ref_num,
                    "make": res.make,
                    "model": res.model,
                    "score": res.score,
                    "result": res.result,
                    "num_plate": res.num_plate,
                    "comment": res.comment,
                    "created_at": str(res.created_at),
                    "updated_at": str(res.updated_at),
                    "source_name": res.source_name,
                    "claim_state": res.claim_state,
                    "user_id": res.user_id,
                    "image_count": res.image_count,
                    "reviewer_comment": res.reviewer_comment
                }

            return jsonify(response)

        except Exception as e:
            return {"error": str(e)}
Exemplo n.º 7
0
    def get(self):

        try:
            res = DB_query.getAssessReport(claim_summary).first()

            try:

                print("res in try----", res.total_claims)

                response = {
                    "total_claims": res.total_claims,
                    "completed": res.completed,
                    "failed": res.failed
                }

                print("response-----------------------", response)

            except:
                print("res in except ----", res[0])

                response = {
                    "total_claims": str(res[0]),
                    "completed": str(res[1]),
                    "failed": str(res[2])
                }

                print("response of except-----------------------", response)

            return jsonify(response)

        except Exception as e:
            return {"error": str(e)}
    def get(self):
        try:
            results = DB_query.get(insurance_damage)

            response = {}

            for index, res in enumerate(results):
                print(res.ref_num)
                path = "media/car_image/" + res.ref_num + '/' + res.file_name

                response[index] = {
                    "coordinates": res.original_coordinates,
                    "image_path": path,
                }

            return jsonify(response)

        except Exception as e:
            return {"error": str(e)}
    def get(self):
        try:
            results = DB_query.get(insurance_carimage)
            response = {}
            for index, res in enumerate(results):
                response[index] = {
                "id": res.id,
                "name": res.name,
                "ref_num": res.ref_num,
                "picture": res.picture,
                "created_at": res.created_at,
                "updated_at": res.updated_at,
                "vehicle_id": res.vehicle_id,
                "side": res.side
                }
            return jsonify(response)

        except Exception as e:
            return {"Error" : str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))
Exemplo n.º 10
0
    def get(self):

        try:
            results = DB_query.get(insurance_partdamage)
            print("results------------", results)

            response = {}

            for index, res in enumerate(results):
                part_id = res.part_id
                result_part = db.session.query(insurance_part.picture).filter_by(id = part_id)
                response[index] = {
                "coordinates": res.coordinates,
                "image_path": result_part[0].picture,
                }

            return jsonify(response)

        except Exception as e:
            return {"error" : str(e)}
    def get(self):
        try:
            results = DB_query.get(insurance_damage)
            response = {}
            for index, res in enumerate(results):
                response[index] = {
                    "id": res.id,
                    "side": res.side,
                    "ref_num": res.ref_num,
                    "bounds": res.bounds,
                    "original_coordinates": res.original_coordinates,
                    "edited_coordinates": res.edited_coordinates,
                    "picture": res.picture,
                    "created_at": res.created_at,
                    "updated_at": res.updated_at,
                    "vehicle_id": res.vehicle_id,
                    "file_name": res.file_name
                }
            return jsonify(response)

        except Exception as e:
            return {"Error": str(e)}
            logger.debug("\n------- Something went wrong -------\n", str(e))