Imagine if your phone, or whatever device you use, kept track of your health better than your family physician does; Imagine if it could tell you ahead of time if you were getting sick before you were aware of symptoms, or told you what to do to avoid getting sick; Imagine if it could share your information with medical professionals, give you referrals to specialists and even prescribe medications for you. All of that is possible, or it soon will be.

Over the coming decades, new technologies will vastly improve health care. Technologies like stem cell and gene therapies, nanotechnology, robotics, 3D printed limbs, organs and tissues and an array of new pharmaceuticals could allow people to live longer, healthier lives and eradicate diseases which have plagued humanity since pre-history.

Of course, all of these technologies will come with a price tag and add to the already high cost of quality health care. One of the ways to minimize those costs will be to cut down on ER visits and doctor’s visits. Another way to cut costs will be to catch diseases and other health conditions early so that they treatment can begin before they become serious. Fortunately, relatively inexpensive technology will help with both of these things.

Right now, on my iPhone, there is an app that includes a step counter and various functions to help keep track of your activity, your sleep patterns and your diet. It also stores important medical information. However, this is just a toy compared to what is possible, or what will shortly be possible.

In the future, using the internet of things, various sensors, user inputs and in some cases implants it will do far more. A likely future health app will store your medical history including information on allergies and prescriptions, and your genetic information. It will monitor your activity levels, heart rate, temperature, blood pressure and weight. It will also monitor any symptoms you experience, ranging from aches and pains to indigestion, colds and flu and even mental health symptoms such as anxiety and depression.

In addition to monitoring you, it will monitor local, national and international public health databases. It will also monitor weather, airborne allergens and pollution. Finally, it will have access to the whole of medical knowledge, from the most basic texts to the very latest published medical research.

Using aggregated, anonymous data public health officials will be able to better allocate resources. They will be able to monitor the spread of disease in real-time. In some cases, it will allow them to trace disease outbreaks or cases of things like food poisoning back to the source. Hospitals will be able to bring in staff or send people home based on how the city is feeling today and long-term trends will allow governments to anticipate short and long-term trends and budget accordingly.

For you, as the end-user of the app, it will be able to tell you what you should and shouldn’t worry about. It will warn you if you are heading out on a day when you could have allergy problems. It will give you a heads up if there is a flu outbreak in a part of the city that you’re planning to visit. It will monitor your health and look for trends you should keep an eye on. It will tell you when you need to visit a doctor for your symptoms, but more frequently, it will refer you to a lab to gather further data or simply diagnose you and tell you what you should do next. (There are already artificial intelligence systems that are better at diagnosing patients than doctors are.)

Before it recommends a treatment or prescribes a drug, it will be able to run simulations using your DNA, blood chemistry and gut microbiome to determine how you are likely to react to it. That will allow it to not only recommend the right drug but to monitor the side effects you might experience.

All of this means a more efficient health care system and better health outcomes for individuals, with fewer doctor’s appointments or emergency room visits. It will also make the benefits of advances in medical technology available to more people, without bankrupting government healthcare systems.