// people and affiliations

Table person {
  email text [PK]
  first_name text [not null]
  last_name text [not null]
}

Table affiliation {
  org_name text [PK]
  website text [not null]
  country text [not null]
}

Table person_affiliation {
  email text [PK]
  org_name text [PK]
  from_date date
  to_date date
}

Ref: person_affiliation.email > person.email
Ref: person_affiliation.org_name > affiliation.org_name

// papers and authors

Table paper {
  paper_id int [PK, increment]
  title text [not null]
  abstract text [not null]
  filename text [not null]
  contact_email text [not null]
  year int [not null]
}

Table paper_author {
  paper_id int [PK]
  email text [PK]
  rank int [not null, note: "author order"]
}

Table conference {
  year int [PK]
  location text [not null]
}

Ref: paper.contact_email > person.email
Ref: paper.year > conference.year
Ref: paper_author.paper_id > paper.paper_id
Ref: paper_author.email > person.email

// reviews and reviewers

Table review {
  paper_id int [PK]
  email text [PK]
  merit int [not null]
  relevance int [not null]
  readability int [not null]
  originality int [not null]
  author_comments text [not null]
  committee_comments text
  note: "Scores range from 1 to 5"
}

Table reviewer {
  email text [PK]
  phone text
}

Ref: review.paper_id > paper.paper_id
Ref: review.email > reviewer.email
Ref: person.email - reviewer.email

// match papers with reviewers

Table topic {
  topic_id int [PK, increment]
  topic_name text [not null]
}

Table paper_topic {
  paper_id int [PK]
  topic_id int [PK]
}

Table expertise {
  email text [PK]
  topic_id int [PK]
}

Ref: paper_topic.paper_id > paper.paper_id
Ref: paper_topic.topic_id > topic.topic_id
Ref: expertise.email > reviewer.email
Ref: expertise.topic_id > topic.topic_id

// history of status changes

Enum status {
  SUBMITTED
  UNDER_REVIEW
  REVISION
  RESUBMITTED
  REJECTED
  ACCEPTED
  PUBLISHED
}

Table history {
  paper_id int [PK]
  timestamp timestamp [PK]
  paper_status status [not null]
  notes text
}

Ref: history.paper_id > paper.paper_id
