refactored sample_analyses