-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain_model.py
More file actions
63 lines (48 loc) · 1.29 KB
/
domain_model.py
File metadata and controls
63 lines (48 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from typing import List
from pydantic import BaseModel
import uuid
class Author(BaseModel):
name: str
principle_investigator: bool
contact_author: bool
class Proposal(BaseModel):
serial_number: str
id: str
authors: List[Author] = None
title: str
abstract: str
scientific_justification: str
def create_proposal(id: str):
author1_data = {
"name": "Author1",
"principle_investigator": False,
"contact_author": False,
}
author1 = Author(**author1_data)
author2_data = {
"name": "Author2",
"principle_investigator": True,
"contact_author": True,
}
author2 = Author(**author2_data)
proposal_data = {
"serial_number": str(uuid.uuid4()),
"id": id,
"authors": [author1, author2],
"title": "title1",
"abstract": "abstract1",
"scientific_justification": "scientific_justification1",
}
return Proposal(**proposal_data)
def get_new_serial_number():
return str(uuid.uuid4())
def create_invalid_proposal(id: str):
proposal_data = {
"serial_number": "",
"id": "invalid id: " + id,
"authors": [],
"title": "",
"abstract": "",
"scientific_justification": "",
}
return Proposal(**proposal_data)