Code updates according to xsd
storing purposeflag (key study, etc)
parsing studyresulttype