  The JWST is allowing new measurements of gas-phase metallicities in galaxies
between cosmic noon and cosmic dawn through observations of multiple rest-frame
optical/ultraviolet [OIII], [OII], and hydrogen Balmer series lines. The most
robust approach to such measurements uses luminosity ratios between the excited
auroral transition, [OIII] 4364A, and the lower [OIII] 5008A/4960A lines to
determine the gas temperature. The ratio of the luminosities in the latter
transitions to those in hydrogen Balmer series lines then yield relatively
clean metallicity estimates. In the absence of detection of the, often faint,
[OIII] auroral line, however, the ratios of various [OIII], [OII], [NII], and
Balmer lines are instead used to determine metallicities. Here we present a
refined approach for extracting metallicities from these ``strong line
diagnostics''. Our method exploits empirical correlations between the
temperature of OIII/OII regions and gas-phase metallicity, which lie close to
theoretical expectations from thermal equilibrium calculations. We then show,
from first principles, how to extract metallicities from traditional strong
line diagnostics, R2, R3, R23, O3O2, and N2O2. We show that these ratios depend
also on ionization correction factors, but that these can be determined
self-consistently along with the metallicities. We quantify the success of our
method using metallicities derived from galaxies with auroral line
determinations and show that it generally works better than previous empirical
approaches. The scatter in the observed line ratios and redshift evolution are
largely explained by O3O2 variations. We provide publicly available routines
for extracting metallicities from strong line diagnostics using our
methodology.
