Skip to content

Commit b7592d8

Browse files
Merge branch 'main' of github.com:brain-image-library/py-inventory into main
2 parents 0272d5f + 3a69585 commit b7592d8

File tree

3 files changed

+161
-11
lines changed

3 files changed

+161
-11
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Brain Image Library
2+
3+
The Brain Image Library (BIL) is a national public resource enabling researchers to deposit, analyze, mine, share and interact with large brain image datasets. BIL encompasses the deposition of datasets, the integration of datasets into a searchable web-accessible system, the redistribution of datasets, and a computational enclave to allow researchers to process datasets in-place and share restricted and pre-release datasets.
4+
5+
BIL serves a geographically distributed customer base including large confocal imaging centers that are generating petabytes of confocal imaging datasets per year. For these customers, the library serves as an archive facility for whole brain volumetric datasets from mammals. BIL also serves geographically distributed researchers who want to interact with and download library datasets.
6+
7+
The Brain Image Library is operated as a partnership between the Biomedical Applications Group at the [Pittsburgh Supercomputing Center](https://www.psc.edu/) and the Center for Biological Imaging at the University of Pittsburgh.
8+
9+
---
10+
Copyright © 2023 Pittsburgh Supercomputing Center. All Rights Reserved.
11+
12+
The [Biomedical Applications Group](https://www.psc.edu/biomedical-applications/) at the [Pittsburgh Supercomputing
13+
Center](http://www.psc.edu) in the [Mellon College of Science](https://www.cmu.edu/mcs/) at [Carnegie Mellon University](http://www.cmu.edu).

braininventory/get.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ def __get_number_of_datasets(df):
3030
def __get_completeness_score(df):
3131
return df['score'].sum()/len(df)
3232

33+
def __is_reachable(url):
34+
response = requests.get(url)
35+
36+
if response.status_code == 200:
37+
return True
38+
else:
39+
return False
40+
3341
def __get_metadata_version(df):
3442
return df['metadata_version'] .value_counts().to_dict()
3543

@@ -45,7 +53,7 @@ def __get_award_number(df):
4553
def __get_species(df):
4654
return df['species'].value_counts().to_dict()
4755

48-
def __ get_cnbtaxonomy(df):
56+
def __get_cnbtaxonomy(df):
4957
return df['cnbtaxonomy'].value_counts().to_dict()
5058

5159
def __get_samplelocalid(df):
@@ -77,16 +85,18 @@ def report():
7785
report['number_of_datasets'] = __get_number_of_datasets(df)
7886
report['completeness_score'] = __get_completeness_score(df)
7987
report['metadata_version'] = __get_metadata_version(df)
80-
report['contributor'] = __get_contributor(df)
81-
report['affiliation'] = __get_affilation(df)
82-
report['award_number'] = __get_award_number(df)
83-
report['species'] = __get_species(df)
84-
report['cnbtaxonomy'] = __ get_cnbtaxonomy(df)
85-
report['samplelocalid'] = __get_samplelocalid(df)
86-
report['genotype'] = __get_genotype(df)
87-
report['generalmodality'] = __get_generalmodality(df)
88-
report['technique'] = __get_technique(df)
89-
report['locations'] = __get_locations(df)
88+
report['contributor'] = __get_contributor(df)
89+
report['affiliation'] = __get_affilation(df)
90+
report['award_number'] = __get_award_number(df)
91+
report['species'] = __get_species(df)
92+
report['cnbtaxonomy'] = __get_cnbtaxonomy(df)
93+
report['samplelocalid'] = __get_samplelocalid(df)
94+
report['genotype'] = __get_genotype(df)
95+
report['generalmodality'] = __get_generalmodality(df)
96+
report['technique'] = __get_technique(df)
97+
report['locations'] = __get_locations(df)
9098

99+
report['is_reachable'] = df['URL'].apply(__is_reachable)
100+
91101
return report
92102

notebooks/Untitled.ipynb

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 9,
6+
"id": "ec311d94-3350-4a60-9418-e934fb65487a",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"import braininventory"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 10,
16+
"id": "cd60e1b5-e898-4c20-81fd-61bda774e59c",
17+
"metadata": {},
18+
"outputs": [
19+
{
20+
"data": {
21+
"text/plain": [
22+
"{'date': '2023-07-07',\n",
23+
" 'number_of_datasets': 7198,\n",
24+
" 'completeness_score': 0.997031232284329,\n",
25+
" 'metadata_version': {1.0: 5755, 2.0: 1443}}"
26+
]
27+
},
28+
"execution_count": 10,
29+
"metadata": {},
30+
"output_type": "execute_result"
31+
}
32+
],
33+
"source": [
34+
"data = braininventory.get.today()\n",
35+
"report = braininventory.get.report()\n",
36+
"report"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"execution_count": 11,
42+
"id": "078104fd-1d0d-4fb9-b170-8fea75802669",
43+
"metadata": {},
44+
"outputs": [
45+
{
46+
"data": {
47+
"text/plain": [
48+
"Index(['score', 'metadata_version', 'dataset_uuid', 'bildirectory', 'exists',\n",
49+
" 'project', 'is_biccn', 'bil_uuid', 'contributorname', 'affiliation',\n",
50+
" 'award_number', 'species', 'ncbitaxonomy', 'samplelocalid', 'genotype',\n",
51+
" 'generalmodality', 'technique', 'locations', 'URL', 'temp_file',\n",
52+
" 'json_file', 'md5_coverage', 'sha256_coverage'],\n",
53+
" dtype='object')"
54+
]
55+
},
56+
"execution_count": 11,
57+
"metadata": {},
58+
"output_type": "execute_result"
59+
}
60+
],
61+
"source": [
62+
"data.keys()"
63+
]
64+
},
65+
{
66+
"cell_type": "code",
67+
"execution_count": 12,
68+
"id": "e0b560fa-fdeb-44af-9653-ecd28f29cef1",
69+
"metadata": {},
70+
"outputs": [
71+
{
72+
"data": {
73+
"text/plain": [
74+
"0 https://download.brainimagelibrary.org/f1/60/f...\n",
75+
"1 https://download.brainimagelibrary.org/90/a9/9...\n",
76+
"2 https://download.brainimagelibrary.org/dd/90/d...\n",
77+
"3 https://download.brainimagelibrary.org/9a/ae/9...\n",
78+
"4 https://download.brainimagelibrary.org/9a/ae/9...\n",
79+
" ... \n",
80+
"7193 https://download.brainimagelibrary.org/84/d8/8...\n",
81+
"7194 https://download.brainimagelibrary.org/77/72/7...\n",
82+
"7195 https://download.brainimagelibrary.org/dd/c8/d...\n",
83+
"7196 https://download.brainimagelibrary.org/6e/38/6...\n",
84+
"7197 https://download.brainimagelibrary.org/01/fc/0...\n",
85+
"Name: URL, Length: 7198, dtype: object"
86+
]
87+
},
88+
"execution_count": 12,
89+
"metadata": {},
90+
"output_type": "execute_result"
91+
}
92+
],
93+
"source": [
94+
"data['URL']"
95+
]
96+
},
97+
{
98+
"cell_type": "code",
99+
"execution_count": null,
100+
"id": "596642ad-c204-41fd-b6c8-93e3dc53fd04",
101+
"metadata": {},
102+
"outputs": [],
103+
"source": []
104+
}
105+
],
106+
"metadata": {
107+
"kernelspec": {
108+
"display_name": "Python 3",
109+
"language": "python",
110+
"name": "python3"
111+
},
112+
"language_info": {
113+
"codemirror_mode": {
114+
"name": "ipython",
115+
"version": 3
116+
},
117+
"file_extension": ".py",
118+
"mimetype": "text/x-python",
119+
"name": "python",
120+
"nbconvert_exporter": "python",
121+
"pygments_lexer": "ipython3",
122+
"version": "3.8.8"
123+
}
124+
},
125+
"nbformat": 4,
126+
"nbformat_minor": 5
127+
}

0 commit comments

Comments
 (0)