# Data Matrix Based Low Cost Autonomous Detection of Medicine Packages
## 1 Introduction  
Healthcare systems continuously seek for innovative treatments to overcome the unmet health needs as well as the unforeseeable issues, such as COVID-19, that appear without prediction. Medicines are becoming more crucial in the global health coverage and, due to the high complexity and cost of their development and manufacturing, the pharmaceutical price is increasing, which is reflected in the life quality of the end user [1, 2]. According to the World Health Organization (WHO), the counterfeit medicines are problematic, which is evidenced by their entry in the pharmaceutical supply chain, has been negatively affecting the worldwide health. In low and middle income countries, in the time period between 2007 and 2016, approximately 10.5% of the pharmaceutical products were substandard or falsified [3]. Worldwide, between 2013 and 2017, 42% of all the reported counterfeit medicines were from Africa whilst 21% were from America and 21% from Europe [4]. The accounting firm PwC states that 1-30% of drugs in circulation are fake and a high number of people die annually from toxic counterfeit pharmaceuticals [5]. Actually, in 2015, a study related with substandard drugs to fight the malaria in sub-Saharan Africa estimated more than 122,000 deaths per year of children under the age of five [6]. The profitable business associated with a large number of stakeholders belonging to the distribution network (illustrated in Figure 1) increases the difficulty of controlling the market of fraudulently mislabeled medicines [7]. The legislation applied in the Directive 2011/62/EU of the European Parliament and of the Council, and by the Commission Delegated Regulation (EU) 2016/161, looks forward to eradicate the counterfeit medicines by implementing a unique identifier which guarantees medication packaging authenticity. The regulation is set for the usage of a two-dimensional (2D) barcode--a machine-readable Data Matrix, which follows the format defined by the International Organization for Standardisation/International Electrotechnical Commission standard ('ISO/IEC') 16022:2006 [8; 9; 10]. The National Medicine Verification Organization is the entity which allows the trace of medicine from the production to the patient, ensuring its integrity [11], and holds the national repository where the data of the medicine packages circulating in the Portuguese territory resides. The national stakeholders will establish a connection with the repository to perform the verification and deactivation operations of the unique identifier of the Data Matrix. To evaluate the authenticity of the medicine, a comparison is performed between the information in the unique identifier registered by the entity responsible for uploading data to the European Medicines Verification System and the one in the medicine package [12]. This procedure is required in Portugal since the 9 th of February 2019, according to the Decree-Law n.o 128/2013 [13]. Regarding the supply chain, at the pharmacy level, the medicine products are commonly packaged in three different levels: tertiary for logistics purposes (from the wholesaler to the pharmacy), secondary for inventory (performed within the pharmacy) and primary level, where the operator has direct contact with the product (e.g., vials or pills) as illustrated in Figure 2. The medicines can be traced through a bar-code which identifies the product when electronically scanned [14]. To ensure the interoperability of the pharmaceutical products verification repositories, it is mandatory to adopt a harmonized coding approach. The GS1 (Global Standards One) Data Matrix is embraced as the recommended standard, consisting in a unique identifier (product code--Global Trade Item Number (GTIN), serial number, batch number, expire date and, if required, the national registration number) and an anti-tampering device [15]. Figure 1: Product flow schematic. Adapted from [8]. There are actually several mathematical approaches to detect matrix-type markers, such as [17; 18].