That's a must. In some countries this is now automated at the government level, Belgium for instance has an excellent consent mechanism for medical data.
I'd also point out that there is a huge amount of COVID data being shared at the moment and, outside of vaccine trials, I'd be pretty certain a lot of it is not under any sort of informed consent. (As is true of a lot of population statistics generally.)