A representation of that publication data that matches the schema we use in our databases.

def to_dict(self):
        '''A representation of that publication data that matches the schema we use in our databases.'''

        author_list = []
        for author in self.authors:
            author_list.append(
                dict(
                    AuthorOrder = author['AuthorOrder'] + 1, # we should always use 1-based indexing but since this is shared code, I do not want to change the logic above without checking to make sure I don't break dependencies
                    FirstName = author['FirstName'],
                    MiddleNames = ' '.join(author['MiddleNames']), # this is the main difference with the code above - the database expects a string, we maintain a list
                    Surname = author['Surname']
                )
            )

        pub_url = None
        if self.url or self.doi:
            pub_url = self.url or ('http://dx.doi.org/%s' % self.doi)

        return dict(
            Title = self.title,
            PublicationName = self.journal,
            Volume = self.volume,
            Issue = self.issue,
            StartPage = self.startpage,
            EndPage = self.endpage,
            PublicationYear = self.year,
            PublicationDate = self.date,
            RIS = self.RIS,
            DOI = self.doi,
            PubMedID = None,
            URL = pub_url,
            ISSN = None, # eight-digit number
            authors = author_list,
            #
            RecordType = RISEntry.record_types.get(self.publication_type)
        )