Mayor Bill de Blasio signed a bill into law Tuesday that will require the city to release more detailed information every year about the diversity of its schools.

The law, known as the School Diversity Accountability Act, will require the city to release demographic data related to individual grade levels and programs within schools, including gifted and talented and dual-language programs. The law will also require the city to account for any steps it takes to advance diversity in schools and programs citywide.

“This is a step further in our efforts to ensure that our schools are as diverse as our city and people of all communities live, learn, work together,” de Blasio said.

The law, originally sponsored by Brooklyn Council member Brad Lander, came months after the education department reported familiar disparities in offers to gifted and talented programs and the city’s specialized high schools, and a widely publicized 2014 report from the Civil Rights Project at UCLA said the city’s schools are among the most segregated in the nation.

The new annual reports will include what percentage of students within each grade or program at a city school receive special education services and qualify for free or reduced-price lunch. Elementary and middle schools must also provide percentages of students who are English language learners, reside in temporary housing, and are attending a school outside of their home district by individual grade.

The city will also be required to report the number of latecomer students enrolled at each high school outside of the traditional admissions process. Those “over-the-counter” students often pose extra challenges and have traditionally been clustered at low-performing high schools, and reporters have had to formally request data on their enrollment in the past.

The city will also have to provide demographic breakdowns of its pre-kindergarten programs by race, ethnicity, and gender. The diversity of the city’s pre-K programs, which have seen a rapid expansion under the de Blasio administration, has earned fresh scrutiny in recent weeks. In a May report, researcher Halley Potter said the city’s pre-K admissions policies do not encourage significant integration and recommended that the education department collect data to track and encourage diversity.

“It’s a really important first step,” Potter said of the transparency bill last month. “Particularly in schools in neighborhoods with shifting demographics, the schoolwide, overall racial and socioeconomic balance can look really different than one particular grade.”

The education department will also have to report any other criteria being used for high school admissions decisions, including waitlists and “principal discretion.” In 2013, the education department promised to increase monitoring of admissions practices after an audit by former Comptroller John Liu found some selective schools straying from selection criteria published in the high schools directory.

The education department’s first report is due to the Council by the end of the calendar year.