[verb (dictionary form)] + にしたがって [noun] + にしたがって [verb (dictionary form)] + にしたがい [noun] + にしたがい
It comes from the verb したがう従う, "follow, obey", and is often written にしたがって従って. にしたがい is the written form of both meanings.
In the "as" meaning, both halves describe a gradual change, and the verb at the end is usually one of change: なる, きごう〜てくる, きごう〜ていく, さがる下がる. A single event does not fit.
In the "as" meaning, につれて says the same thing and the two can be swapped. Only にしたがって also means "following a rule or an instruction".