Add function to compare documents to update date in esdh. WIP