I had a similar problem as before.
One way to get close to this is to try to figure out what type of data you get first. Write a code that will tell you the difference.
Maybe see if there is a regular expression method for distinguishing between UPC and CSPC.
source share