Building a Pharmacy App: A Journey into Software Engineering
Published: 2023-05-22 20:30:32



###Introduction:
As a student at Flatiron School, I recently had the opportunity to dive into the exciting world of software engineering and develop a pharmacy app for a class project. This project challenged me and my teammates to apply our knowledge of programming concepts, user experience design, and database management to create a functional and user-friendly application. In this blog post, I will walk you through the process of creating this pharmacy app, highlighting the key steps and lessons learned along the way.

####1. Understanding the Requirements:
The first step in any software development project is understanding the requirements. I collaborated with my classmates and instructors to identify the core features and functionalities the pharmacy app should have. This included basic user authentication, a medication product catalog, basic shopping cart functionality, and order management. We also needed to demonstrate the ability to work with database relationships using table associations and foreign keys, manage ORM using Alembic migrations, and design a CLI user interface with a seamless menu flow.

####2. Planning and Designing the App:
Once we had a solid understanding of the project requirements, we began the planning and design phase. We outlined the app's architecture, planned our database structure and table relationships, and discussed the user interface and menu options and flow. This ensured that our team was aligned in terms of the overall app structure and user experience.


####3. Setting Up the Development Environment:
Before launching into writing code for the app, we need to set up our development environment. This involved installing the necessary software tools, (Openai, Click, Faker, and Alembic to name a few), configuring a local development server, and establishing a version control repository on Git Hub to facilitate effective progress tracking and seamless collaboration.

####4. Database Management:
To store and manage the app's data, we utilized a SQLAlchemy database. I designed the database schema, including tables for users, products, orders, and shopping carts. I leveraged SQL queries and database migrations to ensure data consistency and efficiency. We also created a separate database to store data pertaining to OTC medications. The separate databases were meant to reflect the pharmacy's need for separation of sensitive patient information to comply with HIPAA regulations. I was particularly proud of the fact that we managed to access and manipulate data from more than one database using multiple SQLAlchemy sessions at the same time.

####5. Implementing User Authentication:
User authentication was an important aspect of our pharmacy app, but with limited time and knowledge, we decided to keep it simple. Our user authentication feature consists of the ability to create and store user login information and to validate user input to reference the correct patient data in the database. In future development we will include password encryption to make the app more secure.

####6. Building the Patient Database and Medication Catalog:
The core of our pharmacy app lay in the tables we created to store patient data and the medication catalog. As a team, we collectively designed and implemented the database schema to store medication details such as name, type, dosage, quantity, and price. By leveraging SQLAlchemy, we collaboratively created a model class for the Patient and Medication tables, empowering us to perform essential CRUD operations and establish relationships with other tables. We also designed a join table called Prescriptions, and designed code that would generate prescription objects linking patients to various medications.

####7. Developing the Shopping Cart Function:
To enhance the user experience, we built a basic shopping cart feature that allows patients to add OTC medications to their shopping cart and keep a running total of the price of their items. This feature is limited, but in future development we would like to implement a method to complete the sale of the selected items. We would also like to link the shopping cart to the selected prescription items to be filled, so that the user can purchase OTC medications and fill prescriptions all in one transaction.


####8. Testing and Debugging:
Throughout the development process, we conducted rigorous testing and debugging to identify and fix any issues or bugs. We performed unit tests, integration tests, and end-to-end tests to validate the app's functionality and ensure a smooth user experience. 

###Conclusion:
I am so grateful for the amazing team I worked with on this project, and very proud of our end result. Building this pharmacy app was extremely challenging, but also extremely rewarding experience. It allowed me to test and expand on the knowledge and skills I have gained during my software engineering journey at Flatiron School. From understanding requirements to planning, designing, coding, and testing, each step was essential in creating a functional and user-friendly application. This project not only enhanced my technical proficiency but also reinforced the importance of collaboration, problem-solving, and attention to detail. Thank you to Matt and Derrick for all your hard work!