Transactions – How to check the transformation of raw values ​​in the blockchain?

Is there a solution for verifying a transformation of raw values ​​in the blockchain?

For example, you have a (private, legitimate) blockchain solution to check how many apples are in your storage. New apples arrive at random every 1 to 5 minutes. The same applies to outgoing apples.

After each hour that has passed, you want to calculate the apples that have arrived within the last hour. After each day you want to calculate the average of apples that arrived per hour.

Does Ethereum (and others) solve this with smart contracts?
What are alternative approaches?

To make it more complex, let's say the transformation itself is very complex and can not be stored in a smart contract – like using a neural network that can not be replicated to all nodes. How can the other nodes confirm that the transformation was done correctly and trustingly and save the result only in the blockchain?