def record( self, record_type, data=None, with_control_number=False, literature_citations=[], # TODO: call `literature_references` data_citations=[], skip_validation=False, other_pids=[], arxiv_eprints=None, dois=None, ): if record_type == "lit": record = self.hep_record() elif record_type == "aut": record = self.author_record() elif record_type == "job": record = self.job_record() elif record_type == "jou": record = self.journal_record() elif record_type == "exp": record = self.experiment_record() elif record_type == "con": record = self.conference_record() elif record_type == "dat": record = self.data_record() elif record_type == "ins": record = self.institutions_record() elif record_type == "sem": record = self.seminars_record() if with_control_number: record["control_number"] = self.control_number() if data: record.update(data) if literature_citations: record.update(self.add_citations(literature_citations)) if data_citations: record.update(self.add_data_citations(data_citations)) if arxiv_eprints: record.update(self.add_arxiv_eprints(arxiv_eprints)) if dois: record.update(self.add_dois(dois)) if other_pids: ids = record.get("ids", []) ids.extend(self.add_other_pids(other_pids)) record["ids"] = ids if not skip_validation: schema_validate(record) return record
def record(self, data=None, with_control_number=False): record = { "$schema": "http://localhost:5000/schemas/records/hep.json", "titles": [{ "title": fake.sentence() }], "document_type": ["article"], "_collections": ["Literature"], } if with_control_number: record["control_number"] = self.control_number() if data: record.update(data) schema_validate(record) return record
def record( self, record_type, data=None, with_control_number=False, literature_citations=[], # TODO: call `literature_references` data_citations=[], skip_validation=False, ): if record_type == "lit": record = self.hep_record() elif record_type == "aut": record = self.author_record() elif record_type == "job": record = self.job_record() elif record_type == "jou": record = self.journal_record() elif record_type == "exp": record = self.experiment_record() elif record_type == "con": record = self.conference_record() elif record_type == "dat": record = self.data_record() elif record_type == "ins": record = self.institutions_record() if with_control_number: record["control_number"] = self.control_number() if data: record.update(data) if literature_citations: record.update(self.add_citations(literature_citations)) if data_citations: record.update(self.add_data_citations(data_citations)) if not skip_validation: schema_validate(record) return record
def validate(self): schema_validate(self)