gabrielaltay commited on
Commit
6f940b6
1 Parent(s): 98567e2

Delete license.py

Browse files
Files changed (1) hide show
  1. license.py +0 -329
license.py DELETED
@@ -1,329 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- """
4
- License objects.
5
- """
6
-
7
- import json
8
- from dataclasses import dataclass
9
- from types import SimpleNamespace
10
- from typing import Dict, Optional
11
-
12
-
13
- @dataclass
14
- class License:
15
- """
16
- Base class from which all licenses inherit
17
-
18
- Args:
19
- name: License title
20
- text: Accompanying information of the license
21
- link: URL to License
22
- version: Current version of license
23
- provenance: Organization providing authorization, if possible
24
- """
25
-
26
- name: Optional[str] = None
27
- short_name: Optional[str] = None
28
- text: Optional[str] = None
29
- link: Optional[str] = None
30
- version: Optional[str] = None
31
- provenance: Optional[str] = None
32
-
33
- @property
34
- def is_share_alike(self):
35
- """
36
- Is Share-alike?
37
- """
38
- # NOTE: leave here has an example of license properties
39
- raise NotImplementedError()
40
-
41
-
42
- @dataclass
43
- class CustomLicense(License):
44
- """
45
- This class is for custom licenses.
46
- It must contain the text of the license.
47
- Optionally its version and a link to the license webpage.
48
- """
49
-
50
- def __post_init__(self):
51
- if self.name is None:
52
- self.name = "Custom license"
53
-
54
- if self.text is None and self.link is None:
55
- raise ValueError(
56
- "A `CustomLicense` must provide either (a) the license text or (b) the license link!"
57
- )
58
-
59
-
60
- def _get_variable_name(k: str) -> str:
61
-
62
- return k.replace("-", "_").upper().replace(".", "p").replace("+", "plus")
63
-
64
-
65
- _GENIA_PROJECT_LICENSE_TEXT = """
66
- GENIA Project License for Annotated Corpora
67
-
68
- 1. Copyright of abstracts
69
-
70
- Any abstracts contained in this corpus are from PubMed(R), a database
71
- of the U.S. National Library of Medicine (NLM).
72
-
73
- NLM data are produced by a U.S. Government agency and include works of
74
- the United States Government that are not protected by U.S. copyright
75
- law but may be protected by non-US copyright law, as well as abstracts
76
- originating from publications that may be protected by U.S. copyright
77
- law.
78
-
79
- NLM assumes no responsibility or liability associated with use of
80
- copyrighted material, including transmitting, reproducing,
81
- redistributing, or making commercial use of the data. NLM does not
82
- provide legal advice regarding copyright, fair use, or other aspects
83
- of intellectual property rights. Persons contemplating any type of
84
- transmission or reproduction of copyrighted material such as abstracts
85
- are advised to consult legal counsel.
86
-
87
- 2. Copyright of full texts
88
-
89
- Any full texts contained in this corpus are from the PMC Open Access
90
- Subset of PubMed Central (PMC), the U.S. National Institutes of Health
91
- (NIH) free digital archive of biomedical and life sciences journal
92
- literature.
93
-
94
- Articles in the PMC Open Access Subset are protected by copyright, but
95
- are made available under a Creative Commons or similar license that
96
- generally allows more liberal redistribution and reuse than a
97
- traditional copyrighted work. Please refer to the license of each
98
- article for specific license terms.
99
-
100
- 3. Copyright of annotations
101
-
102
- The copyrights of annotations created in the GENIA Project of Tsujii
103
- Laboratory, University of Tokyo, belong in their entirety to the GENIA
104
- Project.
105
-
106
- 4. Licence terms
107
-
108
- Use and distribution of abstracts drawn from PubMed is subject to the
109
- PubMed(R) license terms as stated in Clause 1.
110
-
111
- Use and distribution of full texts is subject to the license terms
112
- applying to each publication.
113
-
114
- Annotations created by the GENIA Project are licensed under the
115
- Creative Commons Attribution 3.0 Unported License. To view a copy of
116
- this license, visit http://creativecommons.org/licenses/by/3.0/ or
117
- send a letter to Creative Commons, 444 Castro Street, Suite 900,
118
- Mountain View, California, 94041, USA.
119
-
120
- Annotations created by the GENIA Project must be attributed as
121
- detailed in Clause 5.
122
-
123
- 5. Attribution
124
-
125
- The GENIA Project was founded and led by prof. Jun'ichi Tsujii and
126
- the project and its annotation efforts have been coordinated in part
127
- by Nigel Collier, Yuka Tateisi, Sang-Zoo Lee, Tomoko Ohta, Jin-Dong
128
- Kim, and Sampo Pyysalo.
129
-
130
- For a complete list of the GENIA Project members and contributors,
131
- please refer to http://www.geniaproject.org.
132
-
133
- The GENIA Project has been supported by Grant-in-Aid for Scientific
134
- Research on Priority Area "Genome Information Science" (MEXT, Japan),
135
- Grant-in-Aid for Scientific Research on Priority Area "Systems
136
- Genomics" (MEXT, Japan), Core Research for Evolutional Science &
137
- Technology (CREST) "Information Mobility Project" (JST, Japan),
138
- Solution Oriented Research for Science and Technology (SORST) (JST,
139
- Japan), Genome Network Project (MEXT, Japan) and Grant-in-Aid for
140
- Specially Promoted Research (MEXT, Japan).
141
-
142
- Annotations covered by this license must be attributed as follows:
143
-
144
- Corpus annotations (c) GENIA Project
145
-
146
- Distributions including annotations covered by this licence must
147
- include this license text and Attribution section.
148
-
149
- 6. References
150
-
151
- - GENIA Project : http://www.geniaproject.org
152
- - PubMed : http://www.pubmed.gov/
153
- - NLM (United States National Library of Medicine) : http://www.nlm.nih.gov/
154
- - MEXT (Ministry of Education, Culture, Sports, Science and Technology) : http://www.mext.go.jp/
155
- - JST (Japan Science and Technology Agency) : http://www.jst.go.jp
156
- """
157
-
158
- GeniaProjectLicense = CustomLicense(
159
- name="GENIA Project License for Annotated Corpora",
160
- # NOTE: just in case the link will break
161
- text=_GENIA_PROJECT_LICENSE_TEXT,
162
- link="http://www.nactem.ac.uk/meta-knowledge/GENIA_license.txt",
163
- )
164
-
165
-
166
- _NLM_LICENSE_TEXT = """
167
- National Library of Medicine Terms and Conditions
168
-
169
- INTRODUCTION
170
-
171
- Downloading data from the National Library of Medicine FTP servers indicates your acceptance of the following Terms and Conditions: No charges, usage fees or royalties are paid to NLM for this data.
172
-
173
- GENERAL TERMS AND CONDITIONS
174
-
175
- Users of the data agree to:
176
- acknowledge NLM as the source of the data by including the phrase "Courtesy of the U.S. National Library of Medicine" in a clear and conspicuous manner,
177
- properly use registration and/or trademark symbols when referring to NLM products, and
178
- not indicate or imply that NLM has endorsed its products/services/applications.
179
-
180
- Users who republish or redistribute the data (services, products or raw data) agree to:
181
- maintain the most current version of all distributed data, or
182
- make known in a clear and conspicuous manner that the products/services/applications do not reflect the most current/accurate data available from NLM.
183
-
184
- These data are produced with a reasonable standard of care, but NLM makes no warranties express or implied, including no warranty of merchantability or fitness for particular purpose, regarding the accuracy or completeness of the data. Users agree to hold NLM and the U.S. Government harmless from any liability resulting from errors in the data. NLM disclaims any liability for any consequences due to use, misuse, or interpretation of information contained or not contained in the data.
185
-
186
- NLM does not provide legal advice regarding copyright, fair use, or other aspects of intellectual property rights. See the NLM Copyright page.
187
-
188
- NLM reserves the right to change the type and format of its machine-readable data. NLM will take reasonable steps to inform users of any changes to the format of the data before the data are distributed via the announcement section or subscription to email and RSS updates.
189
-
190
- """
191
- NLMLicense = CustomLicense(
192
- name="National Library of Medicine Terms and Conditions",
193
- # NOTE: just in case the link will break
194
- text=_NLM_LICENSE_TEXT,
195
- link="https://www.nlm.nih.gov/databases/download/terms_and_conditions.html",
196
- )
197
-
198
-
199
- _PHYSIONET_LICENSE_1p5_TEXT = """
200
- The PhysioNet Credentialed Health Data License
201
- Version 1.5.0
202
-
203
- Copyright (c) 2022 MIT Laboratory for Computational Physiology
204
-
205
- The MIT Laboratory for Computational Physiology (MIT-LCP) wishes to make data available for research and educational purposes to qualified requestors, but only if the data are used and protected in accordance with the terms and conditions stated in this License.
206
-
207
- It is hereby agreed between the data requestor, hereinafter referred to as the "LICENSEE", and MIT-LCP, that:
208
-
209
- The LICENSEE will not attempt to identify any individual or institution referenced in PhysioNet restricted data.
210
- The LICENSEE will exercise all reasonable and prudent care to avoid disclosure of the identity of any individual or institution referenced in PhysioNet restricted data in any publication or other communication.
211
- The LICENSEE will not share access to PhysioNet restricted data with anyone else.
212
- The LICENSEE will exercise all reasonable and prudent care to maintain the physical and electronic security of PhysioNet restricted data.
213
- If the LICENSEE finds information within PhysioNet restricted data that he or she believes might permit identification of any individual or institution, the LICENSEE will report the location of this information promptly by email to [email protected], citing the location of the specific information in question.
214
- The LICENSEE will use the data for the sole purpose of lawful use in scientific research and no other.
215
- The LICENSEE will be responsible for ensuring that he or she maintains up to date certification in human research subject protection and HIPAA regulations.
216
- The LICENSEE agrees to contribute code associated with publications arising from this data to a repository that is open to the research community.
217
- This agreement may be terminated by either party at any time, but the LICENSEE's obligations with respect to PhysioNet data shall continue after termination.
218
-
219
- THE DATA ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA.
220
- """
221
- PhysioNetLicense1p5 = CustomLicense(
222
- name="PhysioNet Credentialed Health Data License",
223
- version="1.5",
224
- link="https://physionet.org/content/mimiciv/view-license/0.4/",
225
- # NOTE: just in case the link will break
226
- text=_PHYSIONET_LICENSE_1p5_TEXT,
227
- )
228
-
229
-
230
- UMLSLicense = CustomLicense(
231
- name="UMLS - Metathesaurus License Agreement",
232
- link="https://www.nlm.nih.gov/research/umls/knowledge_sources/metathesaurus/release/license_agreement.html",
233
- )
234
-
235
- _NCBI_LICENSE_TEXT = """
236
- ===========================================================================
237
- *
238
- * PUBLIC DOMAIN NOTICE
239
- * National Center for Biotechnology Information
240
- *
241
- * This software/database is a "United States Government Work" under the
242
- * terms of the United States Copyright Act. It was written as part of
243
- * the author's official duties as a United States Government employee and
244
- * thus cannot be copyrighted. This software/database is freely available
245
- * to the public for use. The National Library of Medicine and the U.S.
246
- * Government have not placed any restriction on its use or reproduction.
247
- *
248
- * Although all reasonable efforts have been taken to ensure the accuracy
249
- * and reliability of the software and data, the NLM and the U.S.
250
- * Government do not and cannot warrant the performance or results that
251
- * may be obtained by using this software or data. The NLM and the U.S.
252
- * Government disclaim all warranties, express or implied, including
253
- * warranties of performance, merchantability or fitness for any particular
254
- * purpose.
255
- *
256
- * Please cite the author in any work or product based on this material.
257
- *
258
- *
259
- ===========================================================================
260
- """
261
- NCBILicense = CustomLicense(
262
- name="National Center fr Biotechnology Information PUBLIC DOMAIN NOTICE",
263
- link="https://github.com/openbiocorpora/genetag/blob/master/LICENSE",
264
- # NOTE: just in case link will break
265
- text=_NCBI_LICENSE_TEXT,
266
- )
267
-
268
- PublicDomainMark_1p0 = CustomLicense(
269
- name="Public Domain Mark 1.0",
270
- text="""This work has been identified as being free of known restrictions under copyright law,
271
- including all related and neighboring rights.
272
- """,
273
- link="https://creativecommons.org/publicdomain/mark/1.0/",
274
- )
275
-
276
-
277
- def load_json_licenses() -> Dict[str, str]:
278
- """
279
- Load all licenses from JSON file.
280
- Amend names to be valid variable names
281
- """
282
-
283
- # shamelessly compied from:
284
- # https://github.com/huggingface/datasets/blob/master/src/datasets/utils/metadata.py
285
- licenses = {
286
- _get_variable_name(k): v
287
- for k, v in json.loads(
288
- open("licenses.json", "r").read()
289
- ).items()
290
- }
291
-
292
- licenses["ZERO_BSD"] = licenses.pop("0BSD")
293
-
294
- return licenses
295
-
296
-
297
- def load_licenses() -> Dict[str, License]:
298
- """
299
- Load `_LICENSES` dict:
300
- - key (str) : license name
301
- - value (License) : instance of license class
302
- """
303
-
304
- json_licenses = load_json_licenses()
305
-
306
- json_licenses.update({"DUA": "Data User Agreement"})
307
-
308
- licenses_kwargs = {k: {"name": v} for k, v in json_licenses.items()}
309
-
310
- licenses = {k: License(**kwargs) for k, kwargs in licenses_kwargs.items()}
311
-
312
- custom_licenses = {
313
- "PUBLIC_DOMAIN_MARK_1p0": PublicDomainMark_1p0,
314
- "GENIA_PROJECT_LICENSE": GeniaProjectLicense,
315
- "NLM_LICENSE": NLMLicense,
316
- "NCBI_LICENSE": NCBILicense,
317
- "UMLS_LICENSE": UMLSLicense,
318
- "PHYSIONET_LICENSE_1p5": PhysioNetLicense1p5,
319
- }
320
-
321
- licenses.update(custom_licenses)
322
- for k, v in licenses.items():
323
- v.short_name = k
324
-
325
- return licenses
326
-
327
-
328
- _LICENSES = load_licenses()
329
- Licenses = SimpleNamespace(**_LICENSES)