updated derivatives php so it will update or add a datastream with logging for either scenario