Inferring pregnancy episodes and outcomes within a network of observational databases