For the past year, the District has been getting a report card.

It’s had its ups and downs — that F for the Alcoholic Beverage Regulation Administration, some C’s for the Department of Motor Vehicles and the Department of Public Works, the near-perfect streak of A’s for the public library system.

But overall, Mayor Vincent C. Gray (D) is so pleased with the District’s grades that he celebrated Tuesday afternoon with balloons and cake.

The ceremony marked the one-year anniversary of Grade D.C., a program that collects residents’ comments on city services and publishes them in the form of letter grades. Gray’s office promotes the program as a cutting-edge use of social media and data analysis in the public sector that has helped city agencies make meaningful improvements.

Grade D.C. was born in December 2011, when newBrand Analytics, a tech company that is now three years old and 70 employees strong, was considering moving outside of the District. Gray visited the office to see whether he could talk the fast-growing start-up into staying.

When he saw a newBrand Analytics product that helps restaurants and hotels harness praise and criticism from their customers, he had an idea. Why not use the same approach for local government?

So newBrand Analytics stayed in Washington — with a new client. The District paid $170,000 for the company to build a rating system customized for the city and $250,000 as an annual use fee, and Grade D.C. formally launched in June 2012.

“To be data-driven is unheard of on the local level. D.C. and Mayor Gray were really ahead of the curve,” said Kam Desai, a co-founder of newBrand Analytics.

Grade D.C. operates a Web site where residents can fill out a survey about their experiences at any of 15 agencies. It also combs Twitter and other Web sites for remarks residents may have made about their interactions with government agencies.

The reactions are rated, by a computer system called a sentiment analysis engine and then by humans, on a positivity scale from one to 10. The numerical values assigned to every comment are tallied to determine the agency’s monthly grade on the familiar A-to-F scale.

The city publishes the results online, and, on the whole, the ratings are glowing. This June, eight agencies received A’s, and all but two of the others made B- minuses or better. The city’s overall rating has been A-minus for four months running.

True, the curve is a bit softer than the typical high school report card system. An A-minus means a score of 83 to 88 points out of 100. A 65 — a score that most students would consider a D — is a B-minus. And it’s hard to call the grades a perfect indicator of an agency’s success — the fire department has the best record of all 15 agencies for the past six months, at a time when D.C. Council members are finding serious fault with the department’s performance.

But Gray’s office emphasizes that the scale is the same as that used by newBrand Analytics’ hotel and restaurant customers and that the city has nothing to do with the grading.

Gray and staff members who have worked on the program point to several instances when the grading system has spurred staff to work toward better ratings or make changes that residents requested. Enough people evaluating the Office on Aging criticized one particular meal, for instance, that the chef took it off the rotating menu. When certain staff members at the DMV drew frequent criticism by name, their managers moved them out of front-desk jobs.

“It’s gotten competitive, which is good. Because everybody wants to get an A, right?” Gray said.

At last month’s U.S. Conference of Mayors meeting, Gray presented the program to other city executives. He was surprised to see so many turn up — 100 to 200, he estimated.

Desai and his co-founder, Neil Kataria, said they have spoken to about 10 of those mayors about instituting a similar program in their cities. They expect to have new local grading initiatives running in the next three to six months.

Gray was happy with the state of the program as he sliced cake at newBrand Analytics’ headquarters. “It feels good to be a part of something that is different and new and I think has a refreshing amount of candor,” he said.