-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathagent.py
More file actions
60 lines (48 loc) · 1.72 KB
/
agent.py
File metadata and controls
60 lines (48 loc) · 1.72 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
import logging
from ga4gh.core.models import Extension
from ga4gh.va_spec.base.core import Agent
from mavedb import __version__
from mavedb.models.user import User
logger = logging.getLogger(__name__)
def mavedb_api_agent() -> Agent:
"""
Create a [VA Agent](https://va-ga4gh.readthedocs.io/en/latest/core-information-model/entities/agent.html)
object for the current MaveDB API version.
"""
version_at_time_of_generation = Extension(
name="mavedbApiVersion",
value=__version__,
)
return Agent(
name="MaveDB API",
agentType="Software",
description=f"MaveDB API agent, version {__version__}",
extensions=[version_at_time_of_generation],
)
def mavedb_vrs_agent(version: str) -> Agent:
"""
Create a [VA Agent](https://va-ga4gh.readthedocs.io/en/latest/core-information-model/entities/agent.html)
object for the passed MaveDB VRS mapping version.
"""
if version is None:
raise ValueError("Version cannot be None")
version_at_time_of_variant_generation = Extension(
name="mavedbVrsVersion",
value=version,
)
return Agent(
name="MaveDB VRS Mapping Agent",
agentType="Software",
description=f"MaveDB VRS mapping agent, version {version_at_time_of_variant_generation.value}",
extensions=[version_at_time_of_variant_generation],
)
def mavedb_user_agent(user: User) -> Agent:
"""
Create a [VA Agent](https://va-ga4gh.readthedocs.io/en/latest/core-information-model/entities/agent.html)
object for the passed MaveDB user.
"""
return Agent(
name=user.username,
agentType="Person",
description=f"MaveDB ORCid authenticated user {user.username}",
)