Skip to content

Commit

Permalink
Updated Firestore with new mapping (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
karm-patel authored May 5, 2022
1 parent 6ca3df4 commit 324c860
Show file tree
Hide file tree
Showing 7 changed files with 4,892 additions and 22 deletions.
772 changes: 772 additions & 0 deletions misc/data_upload_firestore.ipynb

Large diffs are not rendered by default.

493 changes: 493 additions & 0 deletions misc/database_backup_book1_old_urls.csv

Large diffs are not rendered by default.

1,484 changes: 1,484 additions & 0 deletions misc/database_backup_book1_old_urls.json

Large diffs are not rendered by default.

220 changes: 220 additions & 0 deletions misc/figures_url_mapping_book1_backward_compatibility.csv

Large diffs are not rendered by default.

1,612 changes: 1,612 additions & 0 deletions misc/firestore_old_figures_data.ipynb

Large diffs are not rendered by default.

60 changes: 38 additions & 22 deletions misc/mapping_figures_to_urls.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@
"cells": [
{
"cell_type": "markdown",
"id": "4b8112f4",
"id": "7275d268",
"metadata": {},
"source": [
"This script is takes, \n",
"\n",
"input: \"pml1.lof\" file which contains latex souce code of captions of figures\n",
"\n",
"output:mapping of fig_no to original_url "
]
},
{
"cell_type": "markdown",
"id": "9727fce2",
"metadata": {},
"source": [
"## From Latex"
"This notebook is doing following steps:\n",
"1. Take input as \"pml1.lof\" and create mapping of fig_no to urls. \n",
"2. Create dummy notebook for figure which has multiple notebooks. Add caption (after preprocessing it) of such figure to this dummy notebooks which contains pointer to original notebooks of subfigures.\n",
"3. Again create mappig of fig_no to url but this time every fig_no has only one url\n",
"4. Check dead_urls \n",
"5. Firestore experiments: raw code to upload this urls in firestore"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "183398eb",
"execution_count": 1,
"id": "e6c8e9d9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -40,6 +33,14 @@
" from probml_utils.url_utils import check_dead_urls, is_dead_url, github_url_to_colab_url"
]
},
{
"cell_type": "markdown",
"id": "9727fce2",
"metadata": {},
"source": [
"## From Latex .lof"
]
},
{
"cell_type": "code",
"execution_count": 12,
Expand Down Expand Up @@ -2406,7 +2407,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 1,
"id": "96922143",
"metadata": {},
"outputs": [],
Expand All @@ -2416,20 +2417,35 @@
"except ModuleNotFoundError:\n",
" %pip install firebase_admin\n",
" from firebase_admin import credentials, firestore, initialize_app\n",
"from IPython.display import clear_output"
"from IPython.display import clear_output\n",
"\n",
"import json\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 2,
"id": "4f67d736",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"<google.cloud.firestore_v1.client.Client at 0x7fcef41cac40>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"key_path = \"../../key.json\"\n",
"key_path = \"../../key_probml_gcp.json\"\n",
"cred = credentials.Certificate(key_path)\n",
"default_app = initialize_app(cred)\n",
"db = firestore.client()"
"db = firestore.client()\n",
"db"
]
},
{
Expand Down
273 changes: 273 additions & 0 deletions misc/non_figures_url_mapping_book1_backward_compatibility.csv

Large diffs are not rendered by default.

0 comments on commit 324c860

Please sign in to comment.