Jump to main content

Building Personal Medicine Apps to Help Patients

1
2
3
4
5
50 reviews

Abstract

Remembering to take medication or perform a test regularly, consistently, and at specific times can be difficult for elderly people with short-term memory loss, or teenagers absorbed in activities. With mobile devices becoming our constant companions, could a smartphone or tablet offer a solution?

The Massachusetts Institute of Technology (MIT) has created a simple tool making it possible for anyone who has a computer and Internet access to create a reminder app. It is easy, quick, and powerful. In this project, you will build a medicine-reminder app that employs a phone or tablet to remind its user to take action. It is up to you to customize the app and make it work for the user(s) of your choice.

Summary

Areas of Science
Difficulty
 
Time Required
Short (2-5 days)
Prerequisites
None
Material Availability
This project requires the use of a computer with Internet access (preferably wireless). See the Materials list for details.
Cost
Very Low (under $20)
Safety
No issues
Credits

Sabine De Brabandere, PhD, Science Buddies

Objective

Use MIT App Inventor to create a personalized medicine-reminder app.

Introduction

Tired of hearing comments about the downside of electronic devices? What about an app that could help you manage your health? The Massachusetts Institute of Technology (MIT) has developed programming language enabling anyone to create an app on a computer with Internet access. And you don't need a computer programming background. In this science project, you will build a medicine-reminder app. Once you get comfortable with the program, you can build many more apps that facilitate a healthier lifestyle. Only your imagination sets the limit!

If you are young and healthy, you might wonder why people would need a reminder to take their medicines. It turns out that many elderly and chronically ill people have several medications to take, each on a different schedule. This is an increasing problem as the population of elderly adults rises in many countries. Data gathered by researchers (see the chapter by Marek and Antle in the Bibliography suggests that inability to take the right medications at the right time and at the right dose is one of the major reasons an elderly person enters a nursing home. Researchers also conclude that improperly taking medications is the cause of a significant percentage of hospitalizations for elderly patients. The medicine box shown in Figure 1 shows how difficult it can be to keep track of all the medications that patients on multiple medications need to take.

Pill containers separate medicine based on the time and days of the week
Figure 1. Medicine reminder boxes, with compartments for various days and times, can help patients keep track of all the medications they need to take.

Why is it such a big deal if someone does not take their medications as prescribed? Let's zoom into a couple of cases and explore the consequences of not following prescribed medical treatment. For diabetic patients, it is essential to check insulin levels several times a day, as frequent low insulin levels can lead to nerve damage, damaged eyesight, and kidney damage, among a host of other ailments. High blood pressure or high cholesterol levels are other examples that, if not treated regularly, can drastically reduce life expectancy. On the other hand, low blood pressure can put the patient in instant danger, because falls can occur when blood pressure drops below a threshold. While this is bad enough for the patient, not taking medications as directed also puts the wider population at risk. For example, a patient who doesn't follow the prescribed times and doses of antibiotic treatments can increase exposure to others of the number of drug-resistant germs. The resulting infections are difficult to treat. In short, a medicine reminder could help increase the quality of life of patients, shorten illnesses, reduce doctor visits or hospital stays, and reduce the need for more expensive (and toxic) medications.

Convinced? Before you start building a medicine-reminder app, let's see what an app is and what it can do.

App is the abbreviation for application software. It refers to a self-contained computer program designed to run on a mobile device like a smartphone or tablet. As the use of mobile devices has exploded, it has created a new field of science called mobile computing. It focuses on human-computer interactions with mobile devices. Creating apps is a big part of mobile computing.

You may already be familiar with a variety of apps. To name a few possibilities, apps can be programmed to be aware of the location of the device's user, send and receive text messages, give directions to a destination, connect to the Internet, and much more. You might notice that apps can be divided into two main categories: ones that entertain (like games) and ones that fulfill a human need (like informing you where the closest recycling center is). In this computer science project, your challenge is to build an app with App Inventor that reminds an individual to take medications or check blood pressure or blood-sugar level.

App Inventor is a visual programming environment designed to make it easy for anyone to create apps for smartphones and tablets. While the apps made using App Inventor can only be exported to and run on Android devices, you do not need an Android device to create apps using App Inventor. Instead, you use a web interface on a computer to design and code your apps. From there they can be packaged and shared by following a few simple steps.

Before you start coding, you need to have an idea of how your app will work and what it is supposed to do. Computer software engineers call this set of descriptions the user requirements . Do you have an idea what the user requirements of your medicine reminder app will be? Imagine being your intended user. What would you want from a medicine reminder app, and how can your app fill this need?

To get quick results, you will use an incremental approach to build and refine your app. The Procedure of this computer science project will guide you through building the core of your app. You can then pursue several rounds of improvements or changes with the medicine reminder app you have envisioned.

Finally, always keep the user in mind as you build your app. Think of who, how, and when the user will use the app. The better it fits their needs and lifestyle, the more successful your app will be.

Terms and Concepts

Questions

Bibliography

Materials and Equipment

Experimental Procedure

Note: This engineering project is best described by the engineering design process, as opposed to the scientific method. You might want to ask your teacher whether it's acceptable to follow the engineering design process for your project before you begin. You can learn more about the engineering design process in the Science Buddies Engineering Design Process Guide.

Getting Started

If you have not already, watch the video overview of this project in the Summary.

Before you embark on building your medicine reminder app, you need to perform a couple of small tasks: First set up your computer and smartphone or emulator and then work through a couple of tutorials to become familiar with App Inventor 2. This section will walk you through the tasks.

  1. Follow the instructions listed on this App Inventor setup page to prep your computer and smartphone or emulator to use App Inventor.
  2. Have a quick look at the Designer and Blocks Editor overview page.
  3. Now, use the introductory TalkToMe text-to-speech project available from the Beginner Video Tutorials page to build the TalkToMe app. You will learn:
    1. How to connect your computer with your device;
    2. How to use the design mode to design your app;
    3. How to use the block mode to add functionality;
    4. How to code a button; and
    5. How to use the text-to-speech block.

    Note that what an app does is often referred to as its behavior in computer language. The blocks editor is where you code the behavior of your app. The user interface is specified in the design mode.

  4. Before you build your next app, save your project using the Save project command found in the Project drop-down menu, as shown in Figure 2.
    Start menu of the MIT app inventor at appinventor.mit.edu

    A screenshot within the program MIT app inventor shows menu options that allow projects to be saved. At the top of the app window a drop-down menu labeled 'Project' can be clicked to reveal a menu item labeled 'Save project' or 'Save project as...'.


    Figure 2. The Project drop-down menu enables you to save a project, so you can come back to it at a later time.

    Continue on to TalkToMe Part 2 for additional practice programming with App Inventor. You will probably finish these two parts in less than an hour!

  5. You can save this project under a different name using the Save project as... command found in the Project drop-down, as shown in Figure 2.
  6. Next, follow along with the Magic 8-ball tutorial. This will help you get more comfortable with MIT App Inventor and teach you:
    1. How to start a new app,
    2. How to build and use a list; and
    3. How to package your app, so it stays on your phone when you disconnect from the Internet.

    A list is a tool that can be used to store multiple pieces of information at once. You can see it as an ordered series of variables. They are used to store related data. As you learn to program, you will soon realize lists are commonly used and very handy.

    The TalkToMe and Magic 8-ball tutorials will only take you about an hour to complete.

Set the User Requirements for the Core App

  1. You will now start specifying the core of your medicine reminder app. First, decide on the best means to provide information to the user you have in mind.

    This procedure will use spoken messages to communicate with the user. Although this might be appropriate for an elderly person, it might not be appreciated by a student sitting in a classroom or socializing with friends. With your target user in mind, what do you think is the best way to communicate? Some options are listed below. Note you can use combinations of these, but in no way should you feel limited to this list. You can use any means of communication that you feel appropriate:

    1. Spoken message
    2. Vibrating phone (only for cell phones)
    3. Displayed message
    4. Displayed picture

    Adapt the following procedure to reflect your choice.

  2. Set the user requirements.

    The core app will:

    1. display a welcome sentence or welcome image on the screen so the user knows it is running;
    2. provide one reminder message each day, at the hard-coded time of 2 p.m. (Note: This simple approach will let you gain familiarity with MIT App Inventor. Once you have done that, you can expand your app to do other things, let the user customize the reminder time, or add multiple reminders per day. There are more suggestions in the Enhancing Your App section.);
    3. give reminder messages even when the app is running in the background;
    4. make the reminder a spoken message such as "It is now 2 p.m.; please take your medication." You can change this specification to reflect your choice selected in step 1.

Build the Core App

  1. Get a jump start.
    1. Open the TalkToMe text-to-speech app you made in the Getting Started section.
    2. Use the Save project as ... function to save it under a different name. This will prevent overwriting your TalkToMe text-to-speech app.
  2. Create a welcome message.
    1. Change the app so it displays a message and/or image when running. Note you can use the Label or Image component to do this. Click the "?" next to a component (as shown in Figure 3) if you are curious about it. App Inventor will display a short description and a link to a more detailed description. It is a quick way to explore possibilities.
Image upload button in the MIT app inventor

A screenshot within the program MIT app inventor shows components that can be added to an app. Links in the sidebar located on the left side of the page contain the components for apps. Next to each link is a question mark icon that will describe the function of each listed component when pressed.


Figure 3. Clicking on the question mark next to the component will display a short description and a link to a more detailed description of the component.
  1. Select a clock.

    If you had to keep track of the time, you would not constantly stare at your watch, waiting for it to reach exactly 2 p.m., would you? That would be very inefficient — it's difficult to do other things while you are watching a clock. Instead, you would probably look down at your watch occasionally to check the time. You will program your app to do something similar using a timer. App Inventor provides a timer as part of the Clock component. This timer goes off at regular intervals specified in the TimeInterval property of the Clock. With a timer, you can let your app check the time at regular intervals. Whenever the timer goes off, your app jumps to the Clock.Timer event where you can specify what your app needs to do in case the timer fires. How to do this will be explained in step 4. In this step, you will create the Clock component and set the properties of the associated timer.

    1. Drag a Clock component from the list of user interface components in the designer mode palette to you viewer. Note the clock will appear as non-visible component under your screen. Figure 4 can help you find the Clock component.
    2. How often would you like your app to create a timer event? Or, how often does the timer need to go off? You can specify this in the Clock.TimeInterval property of the clock as shown in Figure 5. Note the number in the TimeInterval property needs to be expressed in milliseconds. There are 1000 milliseconds in a second.
    3. Set the TimeInterval property to 1 minute, or 60,000 milliseconds. If you wish to, you can change the TimeInterval property when you start enhancing your app (see the Enhancing Your App section).
    4. Ensure the timer is enabled and fires even when the focus is not on the screen and the app runs in the background. You can do this by checking the checkboxes in the Clock property window as can be seen in Figure 5.
Clock feature in the MIT app inventor

A screenshot within the program MIT app inventor shows a clock component that can be found in the sidebar on the left side of the page.


Figure 4. The Clock component can be found under the User Interface list in the designer mode palette.

Features of the clock component in the MIT app inventor

A screenshot within the program MIT app inventor shows that timed intervals for an alarm can be set in the properties menu of a clock component. The properties menu can be accessed by selecting the clock component from the component sidebar.


Figure 5. The interval between consecutive Clock events can be specified in the properties section of the Clock component. Note the number is specified in milliseconds.
  1. Code the timer event.

    Though you have just created the clock with timer, you still need to tell the app what to do when the timer goes off.

    1. Because you want to code a behavior, you will navigate to the Block mode.
    2. Select the Clock. A list of associated blocks for Clock-specific behaviors will appear as shown in Figure 6.
    3. Drag the When Clock.Timer do ... block to the Blocks viewer. The app will execute the list of blocks clicked in the "do" field every time the timer fires.
Clock component in block mode in the MIT app inventor

A screenshot within the program MIT app inventor shows a clock component listed as Clock1 within the sidebar labeled 'Blocks'. Programming blocks can be seen on the right side of the page in a viewer window. Each block in the viewer window can be programmed to manipulate some aspect of a selected component.


Figure 6. Selecting the Clock component in the Block mode enables you to drag the When Clock.Timer do ... block to the Blocks viewer. You specify what the app should do each time the timer fires in the "do" field.
  1. Check the time.

    You just used a Clock to create a timer. A second use of the Clock component is to manipulate time and express time in various units. The internal time format is called an instant. The clock's Now block (Clock.Now), visible in Figure 7, gives the current time as an instant. The Clock component provides blocks to manipulate instants, for example, to show the second, minute, hour, or day of a given instant. An example of how combining clock blocks allows easy access to the current hour is shown in Figure 8. This particular combination of blocks will show the current hour as a number from 0 (midnight) to 23 (11 pm).

    1. Use Clock blocks to note the current time in a user-friendly format. Figure 8 can help you do this.
    2. Use the TextToSpeech block to let your app give the hour as a spoken message. Note you can click the whole combination shown in Figure 8 into the TextToSpeech block or use an intermediate variable. The Join text block can help you frame the output in a sentence.
    3. As an option, can you do the same or add the minutes to the message?
    4. Run your app and verify
      1. if the time in the spoken message is correct and
      2. if the interval between timed events is what you thought it should be.
    5. Make adjustments where needed.
    6. You can remove the TextToSpeech block(s) once you are sure you have set the clock accurately.
Clock component in block mode in the MIT app inventor

A screenshot within the program MIT app inventor shows a clock component listed as Clock 1 within the sidebar labeled 'Blocks'. A programming block labeled call Clock1 now is highlighted in the viewer window on the right side of the page. The call Clock1 now block will return the value of the clock at the instant the block is initiated.


Figure 7. The Now block of the Clock indicated on this figure gives the current instant in internal time format. Other Clock blocks shown on this figure give easy access to the minute, month, and second of an instant. .

Clock blocks are arranged to return the current hour in the MIT app inventor

A cropped screenshot within the program MIT app inventor shows a call clock1 now block attached to the end of a call clock1 hour instant block. These blocks combined will result in a clock returning the hour value at a given instant.


Figure 8. Combining Clock blocks enable easy readability of the current hour as a number from 0 to 23 (midnight till 11 p.m.).
  1. Add a feature known as "logic checking" to verify that the correct time to send out a reminder has been reached.
    1. Select Control and Logic blocks in the Design mode, as shown in Figure 9.
    2. Start by coding a logical test in the Block mode that verifies if the specified time has been reached. In other words, the logical test should read "TRUE" whenever the specified time of 2 p.m. has been reached and "FALSE" in all other cases. If you need help on logical test blocks, try the Logic Blocks documentation of App Inventor.
    3. Click the logic test you just coded in a control block to direct the app to specific code that will be executed only when a reminder should be sent.
      1. Can you figure out how to use the if ... then block on your own? If you need help, visit the Control Blocks manual of App Inventor. Note: Click the blue square before the "if" in the block displayed in Figure 9 to display additional options available for the if ... then sequence.
Control blocks in the MIT app inventor

A screenshot within the program MIT app inventor shows block components in a sidebar separated into three color coded groups on the left side of the screen: brown, green and blue. Brown blocks represent control blocks, green blocks are logic blocks and blue blocks are math blocks. An if then block is shown as a brown control block in the viewer on the right side of the page.


Figure 9. Control blocks are used to direct the app.
  1. Code the reminder message.
    1. Add code so the app sends the reminder message as specified in the user requirements.
  2. Save your current version.
    1. It is a good habit to frequently save your work.
  3. Test your app.
    1. Test your app in all the possible scenarios you can think of.
    2. Look for loopholes. For example, make sure your message is not repeated several times between 2 p.m. and 3 p.m. Introducing a variable that keeps track of whether the message has been sent out that day (reset this variable to 0 at midnight) is one way to solve this.
    3. Make changes where needed.
    4. Make sure to retest all scenarios after you have implemented changes.

General note: The method presented above is just one way of coding your medicine reminder app. You may discover totally different ways of writing the code that work just as well, or even better! Can you explore App Inventor and come up with a different way to write the program?

Enhancing Your App

This completes a first version of your medicine reminder app. You can now let your imagination run wild. What improvements would you like to implement? If you can, talk to your target users, show them your current app, and listen carefully to their feedback. This will guide you in making improvements that have the biggest impact.

  1. Some improvements you might consider are listed below.
    1. You can change the TimeInterval property of the clock. How do you think this will affect your medicine reminder? Can you find a good tradeoff between accuracy (sending out your reminder at 2 p.m. sharp) and processor use (frequent checking of the time)?
    2. Implement a button to confirm that users have taken the medication or performed a medical test. Repeat the reminder message every 15 minutes until the user confirms by clicking the button.
    3. Let users specify the time they need to take medical action. As an added functionality, you can prompt previous choice(s) each time users open the app. Hint: You might want to look into the TinyDB component of App Inventor if you like to store user choices.
    4. Enable the app to handle multiple reminders each day for different medications or actions.
    5. Let users enter and/or change the text of the reminder message they hear or upload the picture they see.
    6. When users are reminded to perform a test (like measuring blood pressure or glucose levels), ask them to enter their measurement. The app can then store it in a database for historical comparisons and/or create recommendations for the amount of medication to take, send an alert text message to a nurse if levels are above a specified level, etc.
  2. Each improvement iteration should consist of the following steps:
    1. Specify the change or improvement.
    2. Make the changes.
    3. Test your new app.

    The following page will help you understand the Engineering Design Process.

  3. To do many of the improvements listed above, you may need your app to "remember" information like a value, a word, or a sentence. For example, if your app requests information from the user, or if it calculates a value, you will want to remember it somewhere so you can use it later. The way your app remembers things is by storing them in variables. So in essence, variables are placeholders; they can hold information and be overwritten by new information. The video below is a good introduction to how to use variables in App Inventor.
  4. Consult the Bibliography to find additional links to MIT App Inventor tutorials and libraries. They can be a great source of inspiration and help.

Package and Share Your App

Decide on how you would like to share your app:

  • You can share your app in an executable form, which means it can be run on an Android device.
  • You can also share the source code (the text listing of commands for an executable program or app) so other people can load it into App Inventor on their computer, open the project under their account, and work on changes if they wish to.
  • There is also an option to distribute your app on the Google Play Store.
  • The directions on sharing and packaging apps will guide you through the process.
  • Show us what you made! We would love to see what problems your app solves and we may even feature it in a future blog post!
icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Global Connections

The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.

This project explores topics key to Good Health and Well-Being: Ensure healthy lives and promote well-being for all at all ages.

Variations

  • Can you find other medical uses of apps? Here are some examples to get your imagination going:
    • An app that tracks your allergy symptoms so you can map it against the historical pollen index for your area and find out what exactly you are allergic to.
    • As a reminder to take action, you can create an app that displays a Web page with the UV index or allergy information on the phone.
  • For a more challenging project, can your app provide a warning whenever a heat alert is in effect for your region? You can use an API (application programming interface) to retrieve information like weather alerts from sites on the Web supporting APIs. The Weather API designer is just one of them. You will need to ask for an "API key," which then provides a unique URL that you can point your program to for accessing the information supported by the site.
  • Create a game for a phone or tablet that increases awareness of health-related issues or prompts users to live a more healthy lifestyle.
  • Create an app that checks on users and sends a distress text message to an emergency contact. This could be useful for an elderly person living alone or a person going on an adventure. The app could ask at a preset time if you are still OK. If left unanswered, the app could then send a distress message including GPS location to one or a list of emergency contacts. Hints: Locations can be retrieved using the LocationSensor component listed under the Sensor components in the Palette; a text message can be set up using the texting component listed under the social components.
  • Can you create phone apps for other areas in life where one could be useful, like increasing environmental awareness, apps helping researchers collect data, or apps enhancing your social life?

Careers

If you like this project, you might enjoy exploring these related careers:

Career Profile
Pharmacists are the medication experts. They advise doctors, nurses, and patients on the correct drug dosage for a patient's weight, age, health, and gender; on interactions between drugs; on side effects; on drug alternatives; on costs; and on ways to give drugs. They also dispense drugs at pharmacies, according to prescriptions, checking for dangerous drug interactions, and educating patients on how to take drugs, what reactions to watch out for, and how long it should take for drugs to work. Read more
Career Profile
Have you ever heard the expression "Prevention is the best medicine"? Prevention is the fundamental work of all health educators. They attempt to prevent illnesses or diseases in individuals or entire communities through education about nutrition, exercise, or other habits and behaviors. Health educators present scientific information in ways that their audience can relate to, and are sensitive to cultural differences. They are the cornerstone of the public health system, improving health and… Read more
Career Profile
Are you interested in developing cool video game software for computers? Would you like to learn how to make software run faster and more reliably on different kinds of computers and operating systems? Do you like to apply your computer science skills to solve problems? If so, then you might be interested in the career of a computer software engineer. Read more
Career Profile
Have you tried to install new video-game software or connect a new printer to your computer? Doing something like this can be a little scary because of concerns about what may happen to your computer if you don't do it properly. So you read the instructions pamphlet that came with the software or printer and follow it step by step. Thankfully, the instructions are clear and you are successful with the installation! You can credit a technical writer for creating those helpful directions that… Read more
Career Profile
A medical equipment repairer, or medical equipment technician, has an essential role in the fields of healthcare and engineering. From X-ray machines to electric wheelchairs, the medical equipment repairer can fix a wide array of machinery used in hospitals and clinics. They have detailed knowledge of how machines and instruments are to be maintained, how they function, and how to repair them. Broken medical equipment costs hospitals and providers time, money, and may pose safety risks for… Read more
Career Profile
Are you interested in working in the medical field to be an advocate and care for patients? If so, a nurse practitioner may be the career for you. Nurse practitioners require less school than a doctor, but with similar jobs. Nurse practitioners diagnose and treat illness as a part of a healthcare team or by themselves. Another important piece of their job is to teach patients and their families. They help patients stay healthy and teach them how to manage diseases. Nurse practitioners can work… Read more
Career Profile
Are you interested in how a website is set up and how the website runs? As a web developer and designer you could design a website's look and feel and create the code to make sure the website works. You could set up a website for your favorite store with payment options, making sure it works with the ever growing list of browsers and devices. Do you like working behind the scenes? You could design the layout or write the supporting code for an app or website while collaborating with other web… Read more

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Science Buddies Staff. "Building Personal Medicine Apps to Help Patients." Science Buddies, 6 Dec. 2023, https://www.sciencebuddies.org/science-fair-projects/project-ideas/HumBio_p041/human-biology-health/build-a-personal-medicine-app?from=Blog. Accessed 19 Mar. 2024.

APA Style

Science Buddies Staff. (2023, December 6). Building Personal Medicine Apps to Help Patients. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/HumBio_p041/human-biology-health/build-a-personal-medicine-app?from=Blog


Last edit date: 2023-12-06
Top
We use cookies and those of third party providers to deliver the best possible web experience and to compile statistics.
By continuing and using the site, including the landing page, you agree to our Privacy Policy and Terms of Use.
OK, got it
Free science fair projects.