  We study the homotopy type of the space of metrics of positive scalar
curvature on high-dimensional compact spin manifolds. Hitchin used the fact
that there are no harmonic spinors on a manifold with positive scalar curvature
to construct a secondary index map from the space of positive scalar metrics to
a suitable space from the real $K$-theory spectrum. Our main results concern
the nontriviality of this map. We prove that for $2n \geq 6$, the natural
$KO$-orientation from the infinite loop space of the Madsen--Tillmann--Weiss
spectrum factors (up to homotopy) through the space of metrics of positive
scalar curvature on any $2n$-dimensional spin manifold. For manifolds of odd
dimension $2n+1 \geq 7$, we prove the existence of a similar factorisation.
  When combined with computational methods from homotopy theory, these results
have strong implications. For example, the secondary index map is surjective on
all rational homotopy groups. We also present more refined calculations
concerning integral homotopy groups.
  To prove our results we use three major sets of technical tools and results.
The first set of tools comes from Riemannian geometry: we use a parameterised
version of the Gromov--Lawson surgery technique which allows us to apply
homotopy-theoretic techniques to spaces of metrics of positive scalar
curvature. Secondly, we relate Hitchin's secondary index to several other
index-theoretical results, such as the Atiyah--Singer family index theorem, the
additivity theorem for indices on noncompact manifolds and the spectral-flow
index theorem. Finally, we use the results and tools developed recently in the
study of moduli spaces of manifolds and cobordism categories. The key new
ingredient we use in this paper is the high-dimensional analogue of the
Madsen--Weiss theorem, proven by Galatius and the third named author.
