Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dscc-admin-ch committed Jul 22, 2024
1 parent 8aa9dbc commit b05214f
Show file tree
Hide file tree
Showing 37 changed files with 414 additions and 408 deletions.
7 changes: 4 additions & 3 deletions html/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const Search = {

htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
for (const removalQuery of [".headerlinks", "script", "style"]) {
for (const removalQuery of [".headerlink", "script", "style"]) {
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
}
if (anchor) {
Expand Down Expand Up @@ -328,13 +328,14 @@ const Search = {
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
const score = Math.round(Scorer.title * queryLower.length / title.length);
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
normalResults.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
null,
score,
score + boost,
filenames[file],
]);
}
Expand Down
30 changes: 15 additions & 15 deletions html/develop/en/_modules/lomas_server/mongodb_admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,10 @@ <h1>Source code for lomas_server.mongodb_admin</h1><div class="highlight"><pre>



<div class="viewcode-block" id="show_user">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.show_user">[docs]</a>
<div class="viewcode-block" id="get_user">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.get_user">[docs]</a>
<span class="nd">@check_user_exists</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">show_user</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">get_user</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Show a user</span>

<span class="sd"> Args:</span>
Expand Down Expand Up @@ -595,10 +595,10 @@ <h1>Source code for lomas_server.mongodb_admin</h1><div class="highlight"><pre>



<div class="viewcode-block" id="show_archives_of_user">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.show_archives_of_user">[docs]</a>
<div class="viewcode-block" id="get_archives_of_user">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.get_archives_of_user">[docs]</a>
<span class="nd">@check_user_exists</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">show_archives_of_user</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">List</span><span class="p">[</span><span class="nb">dict</span><span class="p">]:</span>
<span class="k">def</span> <span class="nf">get_archives_of_user</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">List</span><span class="p">[</span><span class="nb">dict</span><span class="p">]:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Show all previous queries from a user</span>

<span class="sd"> Args:</span>
Expand Down Expand Up @@ -921,10 +921,10 @@ <h1>Source code for lomas_server.mongodb_admin</h1><div class="highlight"><pre>



<div class="viewcode-block" id="show_dataset">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.show_dataset">[docs]</a>
<div class="viewcode-block" id="get_dataset">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.get_dataset">[docs]</a>
<span class="nd">@check_dataset_and_metadata_exist</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">show_dataset</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">dataset</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">get_dataset</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">dataset</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Show a dataset from dataset collection.</span>

<span class="sd"> Args:</span>
Expand All @@ -941,10 +941,10 @@ <h1>Source code for lomas_server.mongodb_admin</h1><div class="highlight"><pre>



<div class="viewcode-block" id="show_metadata_of_dataset">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.show_metadata_of_dataset">[docs]</a>
<div class="viewcode-block" id="get_metadata_of_dataset">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.get_metadata_of_dataset">[docs]</a>
<span class="nd">@check_dataset_and_metadata_exist</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">show_metadata_of_dataset</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">dataset</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">get_metadata_of_dataset</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">dataset</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">dict</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Show a metadata from metadata collection.</span>

<span class="sd"> Args:</span>
Expand Down Expand Up @@ -1002,9 +1002,9 @@ <h1>Source code for lomas_server.mongodb_admin</h1><div class="highlight"><pre>



<div class="viewcode-block" id="show_collection">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.show_collection">[docs]</a>
<span class="k">def</span> <span class="nf">show_collection</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">collection</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">:</span>
<div class="viewcode-block" id="get_collection">
<a class="viewcode-back" href="../../lomas_server.html#lomas_server.mongodb_admin.get_collection">[docs]</a>
<span class="k">def</span> <span class="nf">get_collection</span><span class="p">(</span><span class="n">db</span><span class="p">:</span> <span class="n">Database</span><span class="p">,</span> <span class="n">collection</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Show a collection</span>

<span class="sd"> Args:</span>
Expand Down
48 changes: 24 additions & 24 deletions html/develop/en/_sources/notebooks/local_admin_notebook.ipynb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"output_type": "stream",
"text": [
"usage: mongodb_admin_cli.py [-h]\n",
" {add_user,add_user_with_budget,del_user,add_dataset_to_user,del_dataset_to_user,set_budget_field,set_may_query,show_user,add_users_via_yaml,show_archives,get_users,get_user_datasets,add_dataset,add_datasets_via_yaml,del_dataset,show_dataset,show_metadata,get_datasets,drop_collection,show_collection}\n",
" {add_user,add_user_with_budget,del_user,add_dataset_to_user,del_dataset_to_user,set_budget_field,set_may_query,get_user,add_users_via_yaml,get_archives,get_users,get_user_datasets,add_dataset,add_datasets_via_yaml,del_dataset,get_dataset,get_metadata,get_datasets,drop_collection,get_collection}\n",
" ...\n",
"\n",
"MongoDB administration script for the database\n",
Expand All @@ -229,7 +229,7 @@
" -h, --help show this help message and exit\n",
"\n",
"subcommands:\n",
" {add_user,add_user_with_budget,del_user,add_dataset_to_user,del_dataset_to_user,set_budget_field,set_may_query,show_user,add_users_via_yaml,show_archives,get_users,get_user_datasets,add_dataset,add_datasets_via_yaml,del_dataset,show_dataset,show_metadata,get_datasets,drop_collection,show_collection}\n",
" {add_user,add_user_with_budget,del_user,add_dataset_to_user,del_dataset_to_user,set_budget_field,set_may_query,get_user,add_users_via_yaml,get_archives,get_users,get_user_datasets,add_dataset,add_datasets_via_yaml,del_dataset,get_dataset,get_metadata,get_datasets,drop_collection,get_collection}\n",
" user database administration operations\n",
" add_user add user to users collection\n",
" add_user_with_budget\n",
Expand All @@ -242,21 +242,21 @@
" set_budget_field set budget field to given value for given user and\n",
" dataset\n",
" set_may_query set may query field to given value for given user\n",
" show_user show all metadata of user\n",
" get_user show all metadata of user\n",
" add_users_via_yaml create users collection from yaml file\n",
" show_archives show all previous queries from a user\n",
" get_archives show all previous queries from a user\n",
" get_users get the list of all users in \"users\" collection\n",
" get_user_datasets get the list of all datasets from a user\n",
" add_dataset set in which database the dataset is stored\n",
" add_datasets_via_yaml\n",
" create dataset to database type collection\n",
" del_dataset delete dataset and metadata from datasets and metadata\n",
" collection\n",
" show_dataset show a dataset from the dataset collection\n",
" show_metadata show metadata from the metadata collection\n",
" get_dataset show a dataset from the dataset collection\n",
" get_metadata show metadata from the metadata collection\n",
" get_datasets get the list of all datasets in \"datasets\" collection\n",
" drop_collection delete collection from database\n",
" show_collection print a collection\n",
" get_collection print a collection\n",
"\n"
]
}
Expand Down Expand Up @@ -340,7 +340,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection datasets\")"
"run(\"python mongodb_admin_cli.py get_collection --collection datasets\")"
]
},
{
Expand All @@ -358,7 +358,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection metadata\")"
"run(\"python mongodb_admin_cli.py get_collection --collection metadata\")"
]
},
{
Expand Down Expand Up @@ -417,7 +417,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection datasets\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection datasets\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -446,7 +446,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection metadata\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection metadata\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -631,7 +631,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection datasets\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection datasets\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -711,7 +711,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection metadata\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection metadata\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -744,7 +744,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_dataset --dataset IRIS\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_dataset --dataset IRIS\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -781,7 +781,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_metadata --dataset IRIS\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_metadata --dataset IRIS\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -845,7 +845,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection users\")"
"run(\"python mongodb_admin_cli.py get_collection --collection users\")"
]
},
{
Expand Down Expand Up @@ -1023,7 +1023,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_user --user 'Madame Frostina'\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_user --user 'Madame Frostina'\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -1107,7 +1107,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_user --user 'Madame Frostina'\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_user --user 'Madame Frostina'\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -1224,7 +1224,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection users\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection users\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -1379,7 +1379,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection users\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection users\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -1490,7 +1490,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection users\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection users\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -1550,7 +1550,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection users\")"
"run(\"python mongodb_admin_cli.py get_collection --collection users\")"
]
},
{
Expand Down Expand Up @@ -1725,7 +1725,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_collection --collection users\", to_dict=True)"
"run(\"python mongodb_admin_cli.py get_collection --collection users\", to_dict=True)"
]
},
{
Expand Down Expand Up @@ -1803,7 +1803,7 @@
}
],
"source": [
"run(\"python mongodb_admin_cli.py show_archives --user Alice\")"
"run(\"python mongodb_admin_cli.py get_archives --user Alice\")"
]
},
{
Expand Down
Loading

0 comments on commit b05214f

Please sign in to comment.