It's the end of the day and you need to pick up your medication - but the pharmacy is closed. What can you do? It was precisely this challenge that inspired me to create an exciting project: the Secure Medication Dispensation Box (SMDB) - a digital pick-up station for medication.
SMDB - The solution for emergencies
In principle, the SMDB is comparable to a DHL packing station. The process is uncomplicated: Pharmacists deposit the medication in the box. Patients select their pharmacy via an intuitive web interface on their smartphone and then receive an individual QR code to open the box.
Behind the scenes: how the technology behind the pick-up box works
The solution is based on the E-prescription workflow. Since access to the telematics infrastructure (TI) is only possible for healthcare professionals with a corresponding smart card, I have built a prototype of the necessary components. The system consists of four central components, which are shown in the following figure.
The system consists of four components, which are shown in the illustration below.
The backend: the heart of the application
The backend server is a Spring Boot microservice - the technical heart of the application and responsible for processing all requests. A Postgres database is used for the persistent storage of recipe data and the filling status of the SMDB. To ensure that only authorized persons have access, a Keycloak an authentication mechanism is implemented. Each authorized user receives a role that is transmitted in the form of a JWT.

Intuitive front end for easy operation
To enable users to access the recipes and QR codes quickly and easily, a frontend is available, which was implemented using NextJS. After successful login, available recipes are retrieved from the backend server and displayed.

Here, the user can select a prescription for redemption and receives a QR code that can be scanned at the SMDB.
The SMDB box in prototype testing
The prototype of the collection box consists of wooden walls and 3D-printed components for the housing. A Spring Boot microservice runs on the Raspberry Pi, which can recognize and decode a QR code using a connected camera. To validate the data it contains, the Raspberry Pi communicates with the backend server via a REST interface. The modeled prototype and the actual result are shown below. The lock latch is locked by default and is only unlocked after successful authentication using a QR code. The status display next to the camera also informs the user about the success of the door opening.


Conclusion: lots of potential, still room for improvement
The work shows that digital medication collection is technically feasible. However, a more robust box, encryption, signatures and other adaptations are needed for real productive use.
The SMDB is a step towards the future - and an impetus for new approaches in the supply of medicines.



