Carolyn Lye, a student at Yale School of Medicine, isn’t used to going undercover. But last year, as part of an internship, she posed as someone looking for her grandmother’s health records.

Five months, 86 hospitals and hundreds of phone calls later, her tedious detective work revealed significant hurdles in patient access to medical records, which is guaranteed by federal and state laws.

“For many of them, I had to go through the automated process, press 1, then press 2, calling over and over, trying to get a person on the phone,” she told NBC News on Monday. When someone finally did answer, Lye said, she was often scolded for asking too many questions. It didn’t faze her.

“I was focused on the goals of the study,” she said. "I continued to maintain my undercover persona.”

That study, published last week in JAMA Network Open, found a patchwork of roadblocks. Eighty-three percent of the hospitals called gave different instructions on printed forms from the ones given over the phone; over half charged fees above the federal recommendation of $6.50 for electronic records (with one charging $541); and 8 percent had wait times longer than state limits. Three hospitals could not be reached at all — either failing to respond to voicemail or providing no option to leave a voicemail or connect with the appropriate department.

Lye didn’t follow through with any requests; she was just collecting information on the process, so it’s possible that in practice, hospitals would have fared better.

The 1996 Health Insurance Portability and Accountability Act guarantees patients access to their medical records within 30 days, with a possible 30-day extension. Some state laws require a shorter turnaround time. HIPAA allows hospitals to charge a “reasonable” fee that primarily recoups expenses for paper copies.

Dr. Harlan Krumholz, a cardiologist at Yale who oversaw the study, said the arbitrary, and in some cases insurmountable, obstacles interfere with patient care.

“Almost every patient has medical history they recall incompletely,” he told NBC News. “They say, ‘I think I had a heart attack a couple years ago.’ As a doctor, you don’t know what to make of that. What procedures were done, what tests?”

Regina Holliday and other artists paint murals about medical records on the backs of jackets, part of her Walking Gallery project. Courtesy Regina Holliday

He said he often has to conduct tests patients have probably had in the past, wasting time and money. “It’s so common, to have to start over,” he said.

In an address he gave at the 2016 Connected Health Symposium, Krumholz said the CEO of a large health system told him that it wasn’t in the hospital’s interest to make records easy to obtain, because hospitals don’t want patients to go to other providers.

Patient advocate Regina Holliday of Grantsville, Maryland, said access to records is critical for finding mistakes and empowering patients to make decisions about their care.

Holliday’s husband, Frederick, died in 2009 after a brief battle with kidney cancer. At the time of his diagnosis, he was hospitalized, and the couple were not happy with the care he was receiving.

“He looked at me and said, ‘Fight for me, get a second opinion,’ ” she said in an interview.

Holliday requested his medical records to plan their next move. She was told it would take 21 days —time she knew he didn’t have — and cost 73 cents per page. The hospital would not tell her how many pages of records he had.

Her husband ultimately sought care from four other medical facilities over his 12-week illness before he wound up in hospice care. When Holliday eventually reviewed his records, which another doctor later supplied, she said, it was clear that he was not going to survive and that he should have been directed to hospice care much sooner. She also said the record included pages that were duplicates or marked “intentionally left blank,” which patients would normally have to pay for.

“Our horror story of care spiraled out of control because we couldn’t get information in a timely fashion to make decisions on our own,” she said.

Access to medical records may sound like a dry topic, but for advocates, it can be artistically inspiring.

Since her husband’s death, Holliday has painted over 600 murals about patient care. She and other artists promote awareness by painting murals about medical records on the backs of jackets, part of her Walking Gallery project. Her mural “73 Cents,” referring to the price she was quoted for a copy of each page of her husband's records, can be seen at Connecticut Avenue Northwest near Nebraska Avenue.

Dave deBronkart, a health care speaker known as “e-Patient Dave,” survived kidney cancer with the help of an online patient community. He advocates for care to be patient-centered and include better access to medical records. His catchphrase is “Give me my DaM data,” (DaM stands for Data about Me), promoted with a music video. He also has a rap about data, unveiled about four minutes from the end of his TED talk.

“Data is not carefully managed, the way it would be if you did it yourself,” he told NBC News. “I saw a chest X-ray that identified me as a woman. Patients should always check.”

Experts offered advice for patients seeking records:

Look up local state laws on medical records, including processing times.

Ask providers if they offer patients access to electronic portals.

Don’t be afraid to negotiate fees for records and cite HIPAA guidelines.

Ask doctors for medical notes as well as data such as test results.

Lye, the Yale medical student, said she found problems at her hospital too. When she called Yale-New Haven Hospital for the study, she found a discrepancy between what she was told on the phone and official policy about wait time. “They were not in compliance,” she said.