# Design of Safety Evaluation and Risk Traceability System for Agricultural Product Quality
## 3 Construction of Risk Traceability System
### Traceability System Design
#### 3.2.1 System Architecture Design
The service layer of the agricultural product risk traceability system is supported by the data provided by the data layer. It provides data synchronization to the application layer, and the back-end framework provides data management, quality and safety risk assessment calculation, user registration, and other business functions to the front end. 4. The application layer is the business function layer of the risk traceability system. During system development, the application functions are designed and developed according to the traceability function division, the actual agricultural product business scenario, and business logic. The application layer improves the coordination efficiency of the development team. Developers can focus on the development and maintenance of a single function, and coordinate the deployment of different development function modules in the application layer to ultimately realize the system functions. The application layer receives the request information from the front-end users and transmits the request information to the back-end service layer for response and processing. For example, for the detection data of agricultural product inputs by the front-end users, the application layer transmits the data to the back end after receiving it, and the back end calculates the score of the received actual detection data according to the set risk evaluation model algorithm to obtain the risk score. Further mining is conducted according to the obtained scores, and production suggestions and traceability risk objectives are put forward. 5. The display layer is the human-computer interaction interface designed by the user. The display interface of the risk traceability system uses HTML, JavaScript, and other development technologies to achieve interactive functions. The display layer unifies the development of interaction classes and improves the development specification of the system display interface. The risk traceability system uses web technology to provide users with operation functions. Different users can enter the system through different terminal devices. The applicability of web technology is better, and the designed system has better popularization significance. 6. The user layer refers to all users who have clear requirements for the agricultural product risk traceability system. It defines the definition of permissions and the differences in the operation functions of different users. The division of the user layer is conducive to developers to clarify the responsibilities and boundaries between different user roles, including supervision department personnel, production enterprise personnel, enterprise management personnel, etc. The design of the six-layer architecture of the agricultural product risk traceability system defines the responsibilities of each layer and coordinates the relationship between different layers. Through the division of the system architecture, the functions of some layers during development are reused. The division of the six-layer architecture not only clarifies the system structure but also simplifies the workload of subsequent system updating and optimization. When updating and improving the system, it is no longer necessary to reconstruct the whole system, which not only improves development efficiency, it also enhances the practical adaptability of the system. To achieve better processing of the number of requests, services are split and clustered according to the architecture. The interfaces between the separated microservices are exposed. The registration and configuration are designed as a unified whole, and a cluster is formed through mutual calls. The specific microservice technology stack is shown in Figure 4.  
In the actual system deployment process, considering the impact on system flexibility and scalability, a containerized approach is chosen for deployment to achieve distributed search and storage. The design system is divided based on the system architecture, and the separated independent components are deployed separately.