Write an hazard getter for the risk scenario calculator

Maybe we can generalize the current getter to work both with the gmf and the gmf_scenario tables; otherwise we can just introduce another getter. Some preliminary work to simplify the current query is needed.