Skip to content

Commit

Permalink
orcid
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjeangirard committed Jul 8, 2024
1 parent a7ce387 commit 5668630
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions notebooks/ORCID.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 29,
"id": "57abcb3c",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import pandas as pd\n",
"# Please contact scanR team to get your own API access\n",
"scanr_api_url = 'https://scanr.dataesr.ovh/api/scanr-persons/_search' "
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "32fce42a",
"metadata": {},
"outputs": [],
"source": [
"body = {\n",
" 'query': {\n",
" 'bool': {\n",
" 'filter': [\n",
" {\n",
" 'term': {\n",
" 'affiliations.structure.id.keyword': '130026081'\n",
" }\n",
" },\n",
" {\n",
" \"exists\": {\n",
" \"field\": \"orcid\"\n",
" }}\n",
" ]\n",
" },\n",
" },\n",
" 'from': '0',\n",
" 'size': '10000',\n",
" '_source': ['id', 'orcid', 'fullName']\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "2d4c4fa5",
"metadata": {},
"outputs": [],
"source": [
"res = requests.post(scanr_api_url, json=body, timeout=600).json()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "250739fd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6631"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = [e['_source'] for e in res['hits']['hits']]\n",
"len(data)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "379647bb",
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame(data)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 5668630

Please sign in to comment.