Scientists have developed an artificial intelligence system that can predict a person’s risk of developing conditions ranging from dementia to heart failure by analyzing a single night of sleep data.