From San Francisco to Massachusetts, local and state health departments across the country have begun rolling out efforts to stem the spread of the coronavirus by tracing the contacts of those who have tested positive for COVID-19, the disease it causes.

The initiative, known as contact tracing, aims to first locate the infected person, log where they went and with whom they’ve been in contact, then follow up with those contacts to see how they are feeling, if they have been tested and to determine if they should quarantine.

Full coverage of the coronavirus outbreak

The desired outcome: break the chains of transmission of the contagious disease, empower health departments to know where it resides in a community, and ultimately, use that knowledge to know where and in what capacity to lift isolation orders and reopen the economy.

While contact tracing on a national level could cost in the billions of dollars and require hiring more than 100,000 people, public health experts say it's an important step, along with increased testing, to stopping the spread of the virus. To accomplish this, a combination of interviewing the infected — whether by telephone, text or a mobile app — and technology, including using smartphones, to track and monitor people will be needed.

San Francisco plans to use a workforce of 140 people, including medical students from the University of California, San Francisco, librarians and staff from the city attorney's office, to go through lists of people who have tested positive for the virus and interview them. Such laborious sleuthing has been done in the past to understand outbreaks of HIV, sexually transmitted diseases and other respiratory illnesses, including SARS.

As the 15th-largest city in the United States, with more than 880,000 residents, San Francisco currently has more than 1,100 COVID-19 cases and recorded at least 20 deaths as of Monday, comparatively lower numbers that reflect what officials say has been a "flattening of the curve."

Every clinician in the city who cares for someone with COVID-19 and every laboratory that processes a positive test must report the case to the Department of Public Health, which is how San Francisco is building out its database of contacts.

Download the NBC News app for full coverage and alerts about the coronavirus outbreak

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The city's health department is employing software developed by Dimagi, a Massachusetts-based tech company. The firm says its real-time tool isn't tracking people through Bluetooth technology, as tech giants are proposing to do, but rather allows the contact tracers to follow a set of prompts during interviews and keep a queue of cases and the status for each.

The city's public health director, Dr. Grant Colfax, said that participation in contact tracing is voluntary and no one will be asked about their immigration status or for their Social Security number or bank details. While English and Spanish language options are available, he added that the system would also include Cantonese, Mandarin and Tagalog.

While contact tracing will vary depending on one's local or state health departments, San Francisco's program is being eyed as a blueprint for other places ramping up the effort.

Contact tracers typically begin their work with a "pending first case." The case is based on someone who tested positive for COVID-19 and provided the information of others they've identified being in contact with, which usually starts with a family member, roommate or partner.

The tracer attempts contact, usually by telephone, and will tell them, "You are being called because you have been identified as a close contact to a person with a confirmed novel coronavirus infection. Do you know who that person might be? If so, please state their name."

If the contact does not know the name of the positive case on file, then the tracer must explain that "nonetheless, we would like to ask you some questions since we think you may have been exposed to the virus."

To protect privacy, the contact is not told the name of the person who tested positive, although they usually have an idea of who the person is, Dr. Michael Reid, an infectious disease specialist in San Francisco who is running the contact tracing program, said.

The tracer then asks a series of demographic-related questions, including date of birth, preferred language, race and if they live with the person who tested positive. The tracer also asks if they've been tested for COVID-19, and if not, do they require help in getting a test, their occupation and what their living situation is: Do they reside in a single-family home or an apartment complex, homeless shelter or are incarcerated?

Knowing a person's living situation is important so that the city can determine if they need resources to find an appropriate place to quarantine, Lucía Abascal, a contact tracer in San Francisco, said during a recent demonstration of the tool for reporters.

Tracers also assess a contact's current health, checking for physical symptoms, including shortness of breath, a sore threat and cough, if they're immunocompromised, which puts them at a higher risk, and if they have any underlying health conditions.

A clinician would follow up with a person who is classified as high risk in seven to 14 days.

Tracers then ask for details about a person's potential exposure with the positive case. If the patient shows no symptoms, they will still be asked to quarantine for 14 days if they haven't started already.

Tracers inquire if the person has enough food and medication for those two weeks, and if not, they will be referred to the health department for help.

The contact can consent to receiving daily text messages, and they are then put into the system as either high or low risk. Any contact who yields a positive test result would then be followed up with to provide contacts whom they may have potentially exposed.

For San Francisco, Reid said, the "ambitious goal" is to create a case file for everyone who tests positive and build out their contacts from there.

"If we ever want to move beyond shelter-in-place," he told reporters, "we have to accurately capture all of that contact information."