The legislation would require the government to incorporate data on sexual orientation and gender identity in surveys, including the census, that collect other demographic information.

It would give the federal agencies approximately six months to review what information is currently included and develop questions for their surveys, according to the legislation.

Some federal surveys, including the Centers for Disease Control and Prevention's annual Behavioral Risk Factor Surveillance System questionnaire, already contain questions on the topics. But progressive groups, including the Center for American Progress, have urged the administration to broadly incorporate questions on gender identity and sexual orientation into agency surveys.

The Democratic legislation wouldn't require an individual to disclose their sexual orientation or gender identity and would prohibit them from facing a fine if they either refuse to answer or falsely answer a question.

The legislation comes as broader fights over gender identity have put the issue under a national spotlight.

The Justice Department lawsuit against HB2, a North Carolina law that requires individuals to use the public bathroom matching their gender assigned at birth, has gotten support from leading airlines, hotel chains, retailers and tech companies.

Meanwhile, GOP lawmakers have balked over guidance from the Obama administration telling public school districts they should allow transgender students to use bathrooms that match their gender identities.