In Bach chorales, most perfect cadences will follow the same patterns so it's actually a lot less complicated than it first appears! Firstly, we will look at the most common progressions for a perfect cadence. We must look at the notes in the melody to determine which progression to use, the most common are 221 and 321. When we have decided which key we are in, look at the melody. Almost always, the melody notes will follow the pattern 221 or 321. So if we are in C major; DDC or EDC.
The two stock progressions for these are as follows*:321: Ic-V(7)-I221: II7b-V(7)-I*to fully explain this I would need to provide examples/diagrams.
These two stock progressions are found throughout Bach's chorales, and if you follow the formulae, you can't go wrong!