Doi
create_database_entry(doi, query, timestamp)
¶
Inserts the database row for the query DOI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doi
|
str
|
the doi (full, prefix and suffix) |
required |
query
|
Query
|
the query |
required |
timestamp
|
datetime
|
the datetime the DOI was created |
required |
Returns:
| Type | Description |
|---|---|
|
the QueryDOI object |
Source code in ckanext/query_dois/lib/doi.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
create_doi_on_datacite(client, doi, timestamp, query)
¶
Mints the given DOI on datacite using the client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
DataCiteMDSClient
|
the MDS datacite client |
required |
doi
|
str
|
the doi (full, prefix and suffix) |
required |
timestamp
|
datetime
|
the datetime when the DOI was created |
required |
query
|
Query
|
a Query object |
required |
Source code in ckanext/query_dois/lib/doi.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
find_existing_doi(query)
¶
Returns a QueryDOI object representing the query, or returns None if one doesn't exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Query
|
a Query object |
required |
Returns:
| Type | Description |
|---|---|
Optional[QueryDOI]
|
a QueryDOI object or None |
Source code in ckanext/query_dois/lib/doi.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
generate_doi(client)
¶
Generate a new DOI which isn't currently in use. The database is checked for previous usage, as is Datacite itself. Use whatever value is retuned from this function quickly to avoid double use as this function uses no locking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
an instance of the DataCiteMDSClient class |
required |
Returns:
| Type | Description |
|---|---|
|
the full, unique DOI |
Source code in ckanext/query_dois/lib/doi.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
get_client()
¶
Get a datacite MDS API client, configured for use.
Returns:
| Type | Description |
|---|---|
|
a DataCite client object |
Source code in ckanext/query_dois/lib/doi.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
get_prefix()
¶
Gets the prefix to use for the DOIs we mint.
Returns:
| Type | Description |
|---|---|
|
the prefix to use for the new DOIs |
Source code in ckanext/query_dois/lib/doi.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
is_test_mode()
¶
Should we use the test datacite MDS API?
Returns:
| Type | Description |
|---|---|
|
True if we should, False if not. Defaults to True. |
Source code in ckanext/query_dois/lib/doi.py
28 29 30 31 32 33 34 | |
mint_multisearch_doi(query)
¶
Mint a DOI on datacite using their API and create a new QueryDOI object, saving it to the database. If we already have a query which would produce identical data to the one passed then we return the existing QueryDOI object and don't mint or insert anything.
This function handles DOIs created for the versioned datastore's multisearch action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Query
|
the query |
required |
Returns:
| Type | Description |
|---|---|
Tuple[bool, QueryDOI]
|
a boolean indicating whether a new DOI was minted and the QueryDOI object representing the query's DOI |
Source code in ckanext/query_dois/lib/doi.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |