This zone handles the Peak-to-Trough calculation using the Housing Price Indices.

![Peak to Trough Zone.png](lJ8EhPJIwUyd)

First, the data is prepared with some column removals and renamings. Then, in the[ windows recipe](recipe:compute_HPI_PO_state_prepared_windows), for each state the rolling peak-to-trough is computed by taking the maximum past peak and the minimum future trough at each point in time. Finally the worst peak-to-trough by state is taken using a [group by recipe](recipe:compute_worst_peak_to_trough).