refactor citegrap csv database backend specific code