Fix server; add database code; added subject_id task; added workflow