###### Abstract  
The article presents an outline of the concept of a prototype system allowing for the optimization of inventory management in a diagnostic laboratory on the basis of patients results. The effectiveness of laboratory diagnostics depends largely on the appropriate management of resources and the quality of tests. A functional quality management system is an integral element of every diagnostic laboratory, ensuring reliability and appropriate work standards. This system includes maintaining correct and reliable analytical test results as well as the optimal use of the laboratory equipment's processing capacity and the appropriate organization of the supply chain--both analytical material and reagents. It is extremely important to avoid situations in which tests cannot be performed due to a lack of reagents, the overloading of analyzers, or improper calibration. Therefore, the accurate prediction of the number of orders is crucial to optimize the laboratory's operations, both in the short term--for the next few hours and minutes--and in the longer term, even monthly, which will allow for the appropriate planning of reagent stock. As part of the research presented in this article, machine learning methods were used to implement the above functionalities, which allowed for the development of a prototype of a laboratory optimization system using patient test results as a basis. machine learning; optimization; quality control; laboratory diagnostics +
Footnote †: journal:  
The diagnostic process described in Figure 1 processes data acquired from one of the largest companies in Poland that carries out laboratory tests on biological materials obtained in their own facilities and supplied by customers such as hospitals, health clinics, and collection points. The research was conducted using the 10 most frequently performed types of tests, which accounted for a total of 83% of the tests, resulting in a set of 140 million tests over a three-year period. In quality control, methods that involve assessing the quality of laboratory test results based on results obtained from control materials provided by reagent manufacturers have been used for decades. With current production precision, the standard deviations calculated based on control materials are minimal. The necessity for quality control is assessed in relation to exceeding standards calculated based on these deviations, resulting in a very rigorous quality maintenance regime. This ensures a very precise testing process. However, as a consequence of such procedures, many device calibrations and control measurements are performed unnecessarily because the device does not actually exhibit any real deviations. An alternative is the PBRTQC (Patient-Based Real-Time Quality Control) approach, discussed more comprehensively in Section 3.4, essentially involving conducting and maintaining quality control not based on artificial control materials but on indicators derived from actual patient test results and the distribution characteristics obtained from these results. PBRTQC, emerging as an alternative or complementary method to quality control, has attracted considerable interest, and there are numerous strategies that interested users can explore for application in their own laboratories. Nonetheless, there are lingering concerns regarding its effectiveness and practical clinical contexts. Its ability to be applied has been brought into question. According to [PERSON] [1], there is minimal software assistance available, and significant time and statistical expertise are necessary to establish a PBRTQC program. Official guidance documents outlining the pros and cons of the methods are lacking. However, the Clinical and Laboratory Standards Institute guidelines on risk-based QC stand out as an exception, suggesting that the monitoring of aggregated patient results as a QC approach is unaffected by matrix effects.