A scenario explored in the prescient and excellent TV show Person of Interest (2011). We're comfortably able to build The Machine and/or Samaritan by now.