Giter Site home page Giter Site logo

the-vegetarian-vampire / patient-registration-system Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 71 KB

Final Project for CS50P - Introduction to Programming with Python

Home Page: https://www.youtube.com/watch?v=Mxe5N0RC8K4

Python 100.00%
cs50python python cs50

patient-registration-system's Introduction

Patient Registration System

My final project for Harvard's CS50P - Introduction to Programming with Python.

๐Ÿ“น Youtube: https://www.youtube.com/watch?v=Mxe5N0RC8K4

This is a patient registration system, the database of which is a CSV file. The idea of this program is to model the CRUD acronym: create, read, update, and delete from a database.

Requirements:

The program imports: sys, csv, and the emoji library and runs on Python3.

Functionality:

The program contains 5 functions outside of Main().

  1. (1) Register patient
  2. (2) Search patient
  3. (3) Match blood-type
  4. (4) Update prognosis
  5. (5) Delete patient

Main()

is a choice menu which takes user input in the range of 1-5 and passes in a function dependent on user choice. If an incorrect integer or string is entered, main will reprompt the user for correct input. However, "Q", will exit the program via sys.exit.

Screen Shot 2022-12-23 at 4 36 49 PM

(1) Register patient:

via list of dictionaries, takes user input for keys ["name", "blood-type", "location", "prognosis"]. 'Name' uses .strip() and .capitalize() methods. 'Blood-type' prompts for a correct blood-type and uses the emoji library to add a vampire ๐Ÿง›โ€โ™‚๏ธ to the associated blood-type. 'Location' gives the user 3 choices to choose: primary care, surgery, or discharged, and uses the emoji library to add a thermometer ๐ŸŒก, clock ๐Ÿ•‘ or person surfing ๐Ÿ„โ€โ™‚๏ธ to the associated location. 'Prognosis' gives the user 3 choices to choose: good ๐Ÿ˜Ž, poor ๐Ÿค’, critical ๐Ÿค•, and uses the emoji library to add a face with sunglasses, a thermometer, or bandages to the associated prognosis. Lastly, once all input has been received, the program opens a DictWriter and writes the input to the local CSV file and prints user input confirmation.

Screen Shot 2022-12-23 at 4 38 59 PM

(2) Search patient:

takes user input for key 'name', opens DictReader to iterate over the CSV file and returns a printed match with the associated input value 'name', or 'no match found' if none was found.

Screen Shot 2022-12-23 at 4 43 38 PM

(3) Match Blood-Type:

takes user input for key 'blood-type' within ["A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-"], uses the emoji library to add an emoji vampire ๐Ÿง›โ€, then opens DictReader to iterate over the CSV file and returns all matches with the associated input value 'blood-type', or 'no match found' if no matches were found.

Screen Shot 2022-12-23 at 7 54 45 PM

(4) Update prognosis:

takes user input for key 'name', opens DictReader to iterate over the CSV file and find the input. If the input matches a name within the CSV file, the program will prompt the user the 3 choices to choose from: good ๐Ÿ˜Ž, poor ๐Ÿค’, and critical ๐Ÿค•, to update the prognosis. Per user input, the program index's into the key's position and updates the value via csv.writer. If no match is found in the file, the program prints 'no match found' and returns to the choice menu.

Screen Shot 2022-12-23 at 9 59 59 PM

(5) Delete patient:

takes user input for key 'name', opens DictReader to iterate over the CSV file and find the input. If the input matches a name within the CSV file, the program will prompt the user to confirm deletion via "Y/N". If the user confirms "Y", the program index's into the row and writes a new list without the input row deleting it from the CSV file.

Screen Shot 2022-12-23 at 9 13 40 PM

Conclusion:

Given more time I would improve the program: I believe the design would be better served creating 'patient' as a class object for its inheritence properties. As I learned more about CSV files, I learned updating and writing to an existing file may not be the best database; I would use a more interactive database like SQL, MongoDB, or Mongoose to store the data. Additionally, I would specify 'name' input using REGEX or regular expressions, add a patient 'IN' and 'OUT' function using 'datetime', and add a random four digit patient ID number to each patient for flexibility with search criteria.

Overall, I'm happy ๐Ÿ˜Ž with what I've built, the program covers corner cases, achieves what I intended, and provides an excellent, easy to follow user experience.

patient-registration-system's People

Contributors

the-vegetarian-vampire avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.