SAN FRANCISCO — Dr. Alvin Rajkomar was doing rounds with his team at the University of California, San Francisco Medical Center when he came upon a puzzling case: a frail, elderly patient with a dangerously low sodium level.

As a third-year resident in internal medicine, Dr. Rajkomar was the senior member of the team, and the others looked to him for guidance. An infusion of saline was the answer, but the tricky part lay in the details. Concentration? Volume? Improper treatment could lead to brain swelling, seizures or even death.

Dr. Rajkomar had been on call for 24 hours and was exhausted, but the clinical uncertainty was “like a shot of adrenaline,” he said. He reached into a deep pocket of his white coat and produced not a well-thumbed handbook but his iPhone.

With a tap on an app called MedCalc, he had enough answers within a minute to start the saline at precisely the right rate.