egrace479 commited on
Commit
e397019
·
1 Parent(s): 43b69c1

Compare content IDs from Media Cargo (all downloaded images).

Browse files
notebooks/ToL_license_check.ipynb CHANGED
@@ -29,7 +29,7 @@
29
  "name": "stderr",
30
  "output_type": "stream",
31
  "text": [
32
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_74901/4112647395.py:1: DtypeWarning: Columns (5,6,7,14,15) have mixed types. Specify dtype option on import or set low_memory=False.\n",
33
  " df = pd.read_csv(\"../data/predicted-catalog.csv\")\n"
34
  ]
35
  }
@@ -290,7 +290,7 @@
290
  },
291
  {
292
  "cell_type": "code",
293
- "execution_count": 5,
294
  "metadata": {},
295
  "outputs": [],
296
  "source": [
@@ -309,7 +309,7 @@
309
  },
310
  {
311
  "cell_type": "code",
312
- "execution_count": 6,
313
  "metadata": {},
314
  "outputs": [],
315
  "source": [
@@ -527,7 +527,7 @@
527
  },
528
  {
529
  "cell_type": "code",
530
- "execution_count": 9,
531
  "metadata": {},
532
  "outputs": [
533
  {
@@ -536,7 +536,7 @@
536
  "Index(['treeoflife_id', 'eol_content_id', 'eol_page_id'], dtype='object')"
537
  ]
538
  },
539
- "execution_count": 9,
540
  "metadata": {},
541
  "output_type": "execute_result"
542
  }
@@ -548,7 +548,7 @@
548
  },
549
  {
550
  "cell_type": "code",
551
- "execution_count": 10,
552
  "metadata": {},
553
  "outputs": [],
554
  "source": [
@@ -659,14 +659,14 @@
659
  },
660
  {
661
  "cell_type": "code",
662
- "execution_count": 13,
663
  "metadata": {},
664
  "outputs": [
665
  {
666
  "name": "stderr",
667
  "output_type": "stream",
668
  "text": [
669
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_74901/2809897267.py:1: DtypeWarning: Columns (5) have mixed types. Specify dtype option on import or set low_memory=False.\n",
670
  " media = pd.read_csv(\"../data/media_manifest (july 26).csv\")\n"
671
  ]
672
  },
@@ -724,7 +724,7 @@
724
  },
725
  {
726
  "cell_type": "code",
727
- "execution_count": 16,
728
  "metadata": {},
729
  "outputs": [],
730
  "source": [
@@ -733,7 +733,7 @@
733
  },
734
  {
735
  "cell_type": "code",
736
- "execution_count": 20,
737
  "metadata": {},
738
  "outputs": [],
739
  "source": [
@@ -958,128 +958,9 @@
958
  },
959
  {
960
  "cell_type": "code",
961
- "execution_count": 23,
962
  "metadata": {},
963
- "outputs": [
964
- {
965
- "data": {
966
- "text/html": [
967
- "<div>\n",
968
- "<style scoped>\n",
969
- " .dataframe tbody tr th:only-of-type {\n",
970
- " vertical-align: middle;\n",
971
- " }\n",
972
- "\n",
973
- " .dataframe tbody tr th {\n",
974
- " vertical-align: top;\n",
975
- " }\n",
976
- "\n",
977
- " .dataframe thead th {\n",
978
- " text-align: right;\n",
979
- " }\n",
980
- "</style>\n",
981
- "<table border=\"1\" class=\"dataframe\">\n",
982
- " <thead>\n",
983
- " <tr style=\"text-align: right;\">\n",
984
- " <th></th>\n",
985
- " <th>treeoflife_id</th>\n",
986
- " <th>eol_content_id</th>\n",
987
- " <th>eol_page_id</th>\n",
988
- " <th>EOL page ID</th>\n",
989
- " <th>Medium Source URL</th>\n",
990
- " <th>EOL Full-Size Copy URL</th>\n",
991
- " <th>License Name</th>\n",
992
- " <th>Copyright Owner</th>\n",
993
- " </tr>\n",
994
- " </thead>\n",
995
- " <tbody>\n",
996
- " <tr>\n",
997
- " <th>126</th>\n",
998
- " <td>4b56e165-c4d5-49f9-a321-ac9474d099f3</td>\n",
999
- " <td>2753529.0</td>\n",
1000
- " <td>1225965.0</td>\n",
1001
- " <td>NaN</td>\n",
1002
- " <td>NaN</td>\n",
1003
- " <td>NaN</td>\n",
1004
- " <td>NaN</td>\n",
1005
- " <td>NaN</td>\n",
1006
- " </tr>\n",
1007
- " <tr>\n",
1008
- " <th>174</th>\n",
1009
- " <td>421678a0-c8ec-43c8-815c-fc5888835068</td>\n",
1010
- " <td>16288.0</td>\n",
1011
- " <td>45514264.0</td>\n",
1012
- " <td>NaN</td>\n",
1013
- " <td>NaN</td>\n",
1014
- " <td>NaN</td>\n",
1015
- " <td>NaN</td>\n",
1016
- " <td>NaN</td>\n",
1017
- " </tr>\n",
1018
- " <tr>\n",
1019
- " <th>177</th>\n",
1020
- " <td>be81bd8c-16a7-4911-8279-431245d67195</td>\n",
1021
- " <td>2730639.0</td>\n",
1022
- " <td>1034220.0</td>\n",
1023
- " <td>NaN</td>\n",
1024
- " <td>NaN</td>\n",
1025
- " <td>NaN</td>\n",
1026
- " <td>NaN</td>\n",
1027
- " <td>NaN</td>\n",
1028
- " </tr>\n",
1029
- " <tr>\n",
1030
- " <th>259</th>\n",
1031
- " <td>fc765c82-84e6-437e-b9a5-1c7601c5be81</td>\n",
1032
- " <td>2717906.0</td>\n",
1033
- " <td>1052077.0</td>\n",
1034
- " <td>NaN</td>\n",
1035
- " <td>NaN</td>\n",
1036
- " <td>NaN</td>\n",
1037
- " <td>NaN</td>\n",
1038
- " <td>NaN</td>\n",
1039
- " </tr>\n",
1040
- " <tr>\n",
1041
- " <th>322</th>\n",
1042
- " <td>8c1e6878-47ac-4f7b-8475-73e71c0e99c3</td>\n",
1043
- " <td>2836995.0</td>\n",
1044
- " <td>957074.0</td>\n",
1045
- " <td>NaN</td>\n",
1046
- " <td>NaN</td>\n",
1047
- " <td>NaN</td>\n",
1048
- " <td>NaN</td>\n",
1049
- " <td>NaN</td>\n",
1050
- " </tr>\n",
1051
- " </tbody>\n",
1052
- "</table>\n",
1053
- "</div>"
1054
- ],
1055
- "text/plain": [
1056
- " treeoflife_id eol_content_id eol_page_id \n",
1057
- "126 4b56e165-c4d5-49f9-a321-ac9474d099f3 2753529.0 1225965.0 \\\n",
1058
- "174 421678a0-c8ec-43c8-815c-fc5888835068 16288.0 45514264.0 \n",
1059
- "177 be81bd8c-16a7-4911-8279-431245d67195 2730639.0 1034220.0 \n",
1060
- "259 fc765c82-84e6-437e-b9a5-1c7601c5be81 2717906.0 1052077.0 \n",
1061
- "322 8c1e6878-47ac-4f7b-8475-73e71c0e99c3 2836995.0 957074.0 \n",
1062
- "\n",
1063
- " EOL page ID Medium Source URL EOL Full-Size Copy URL License Name \n",
1064
- "126 NaN NaN NaN NaN \\\n",
1065
- "174 NaN NaN NaN NaN \n",
1066
- "177 NaN NaN NaN NaN \n",
1067
- "259 NaN NaN NaN NaN \n",
1068
- "322 NaN NaN NaN NaN \n",
1069
- "\n",
1070
- " Copyright Owner \n",
1071
- "126 NaN \n",
1072
- "174 NaN \n",
1073
- "177 NaN \n",
1074
- "259 NaN \n",
1075
- "322 NaN "
1076
- ]
1077
- },
1078
- "execution_count": 23,
1079
- "metadata": {},
1080
- "output_type": "execute_result"
1081
- }
1082
- ],
1083
  "source": [
1084
  "eol_missing_content_ids = eol_df_media.loc[eol_df_media[\"Medium Source URL\"].isna()]\n",
1085
  "eol_missing_content_ids.head()"
@@ -1205,7 +1086,7 @@
1205
  },
1206
  {
1207
  "cell_type": "code",
1208
- "execution_count": 29,
1209
  "metadata": {},
1210
  "outputs": [],
1211
  "source": [
@@ -1216,7 +1097,7 @@
1216
  },
1217
  {
1218
  "cell_type": "code",
1219
- "execution_count": 30,
1220
  "metadata": {},
1221
  "outputs": [],
1222
  "source": [
@@ -1228,7 +1109,7 @@
1228
  },
1229
  {
1230
  "cell_type": "code",
1231
- "execution_count": 31,
1232
  "metadata": {},
1233
  "outputs": [],
1234
  "source": [
@@ -1237,7 +1118,7 @@
1237
  },
1238
  {
1239
  "cell_type": "code",
1240
- "execution_count": 32,
1241
  "metadata": {},
1242
  "outputs": [
1243
  {
@@ -1320,7 +1201,7 @@
1320
  },
1321
  {
1322
  "cell_type": "code",
1323
- "execution_count": 35,
1324
  "metadata": {},
1325
  "outputs": [],
1326
  "source": [
@@ -1331,7 +1212,7 @@
1331
  },
1332
  {
1333
  "cell_type": "code",
1334
- "execution_count": 39,
1335
  "metadata": {},
1336
  "outputs": [],
1337
  "source": [
@@ -1341,7 +1222,7 @@
1341
  },
1342
  {
1343
  "cell_type": "code",
1344
- "execution_count": 36,
1345
  "metadata": {},
1346
  "outputs": [],
1347
  "source": [
@@ -1350,7 +1231,7 @@
1350
  },
1351
  {
1352
  "cell_type": "code",
1353
- "execution_count": 37,
1354
  "metadata": {},
1355
  "outputs": [
1356
  {
@@ -1375,7 +1256,7 @@
1375
  "dtype: int64"
1376
  ]
1377
  },
1378
- "execution_count": 37,
1379
  "metadata": {},
1380
  "output_type": "execute_result"
1381
  }
@@ -1688,7 +1569,7 @@
1688
  },
1689
  {
1690
  "cell_type": "code",
1691
- "execution_count": 38,
1692
  "metadata": {},
1693
  "outputs": [
1694
  {
@@ -1713,7 +1594,7 @@
1713
  "dtype: int64"
1714
  ]
1715
  },
1716
- "execution_count": 38,
1717
  "metadata": {},
1718
  "output_type": "execute_result"
1719
  }
@@ -1929,6 +1810,284 @@
1929
  "eol_cat_df_taxa_media.loc[eol_cat_df_taxa_media[\"Medium Source URL\"].isna()].sample(4)"
1930
  ]
1931
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1932
  {
1933
  "cell_type": "markdown",
1934
  "metadata": {},
 
29
  "name": "stderr",
30
  "output_type": "stream",
31
  "text": [
32
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_59620/4112647395.py:1: DtypeWarning: Columns (5,6,7,14,15) have mixed types. Specify dtype option on import or set low_memory=False.\n",
33
  " df = pd.read_csv(\"../data/predicted-catalog.csv\")\n"
34
  ]
35
  }
 
290
  },
291
  {
292
  "cell_type": "code",
293
+ "execution_count": 3,
294
  "metadata": {},
295
  "outputs": [],
296
  "source": [
 
309
  },
310
  {
311
  "cell_type": "code",
312
+ "execution_count": 4,
313
  "metadata": {},
314
  "outputs": [],
315
  "source": [
 
527
  },
528
  {
529
  "cell_type": "code",
530
+ "execution_count": 5,
531
  "metadata": {},
532
  "outputs": [
533
  {
 
536
  "Index(['treeoflife_id', 'eol_content_id', 'eol_page_id'], dtype='object')"
537
  ]
538
  },
539
+ "execution_count": 5,
540
  "metadata": {},
541
  "output_type": "execute_result"
542
  }
 
548
  },
549
  {
550
  "cell_type": "code",
551
+ "execution_count": 22,
552
  "metadata": {},
553
  "outputs": [],
554
  "source": [
 
659
  },
660
  {
661
  "cell_type": "code",
662
+ "execution_count": 6,
663
  "metadata": {},
664
  "outputs": [
665
  {
666
  "name": "stderr",
667
  "output_type": "stream",
668
  "text": [
669
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_59620/2809897267.py:1: DtypeWarning: Columns (5) have mixed types. Specify dtype option on import or set low_memory=False.\n",
670
  " media = pd.read_csv(\"../data/media_manifest (july 26).csv\")\n"
671
  ]
672
  },
 
724
  },
725
  {
726
  "cell_type": "code",
727
+ "execution_count": 7,
728
  "metadata": {},
729
  "outputs": [],
730
  "source": [
 
733
  },
734
  {
735
  "cell_type": "code",
736
+ "execution_count": 23,
737
  "metadata": {},
738
  "outputs": [],
739
  "source": [
 
958
  },
959
  {
960
  "cell_type": "code",
961
+ "execution_count": null,
962
  "metadata": {},
963
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  "source": [
965
  "eol_missing_content_ids = eol_df_media.loc[eol_df_media[\"Medium Source URL\"].isna()]\n",
966
  "eol_missing_content_ids.head()"
 
1086
  },
1087
  {
1088
  "cell_type": "code",
1089
+ "execution_count": 9,
1090
  "metadata": {},
1091
  "outputs": [],
1092
  "source": [
 
1097
  },
1098
  {
1099
  "cell_type": "code",
1100
+ "execution_count": 10,
1101
  "metadata": {},
1102
  "outputs": [],
1103
  "source": [
 
1109
  },
1110
  {
1111
  "cell_type": "code",
1112
+ "execution_count": 11,
1113
  "metadata": {},
1114
  "outputs": [],
1115
  "source": [
 
1118
  },
1119
  {
1120
  "cell_type": "code",
1121
+ "execution_count": 12,
1122
  "metadata": {},
1123
  "outputs": [
1124
  {
 
1201
  },
1202
  {
1203
  "cell_type": "code",
1204
+ "execution_count": 13,
1205
  "metadata": {},
1206
  "outputs": [],
1207
  "source": [
 
1212
  },
1213
  {
1214
  "cell_type": "code",
1215
+ "execution_count": 14,
1216
  "metadata": {},
1217
  "outputs": [],
1218
  "source": [
 
1222
  },
1223
  {
1224
  "cell_type": "code",
1225
+ "execution_count": 15,
1226
  "metadata": {},
1227
  "outputs": [],
1228
  "source": [
 
1231
  },
1232
  {
1233
  "cell_type": "code",
1234
+ "execution_count": 16,
1235
  "metadata": {},
1236
  "outputs": [
1237
  {
 
1256
  "dtype: int64"
1257
  ]
1258
  },
1259
+ "execution_count": 16,
1260
  "metadata": {},
1261
  "output_type": "execute_result"
1262
  }
 
1569
  },
1570
  {
1571
  "cell_type": "code",
1572
+ "execution_count": 17,
1573
  "metadata": {},
1574
  "outputs": [
1575
  {
 
1594
  "dtype: int64"
1595
  ]
1596
  },
1597
+ "execution_count": 17,
1598
  "metadata": {},
1599
  "output_type": "execute_result"
1600
  }
 
1810
  "eol_cat_df_taxa_media.loc[eol_cat_df_taxa_media[\"Medium Source URL\"].isna()].sample(4)"
1811
  ]
1812
  },
1813
+ {
1814
+ "cell_type": "markdown",
1815
+ "metadata": {},
1816
+ "source": [
1817
+ "## Compare Media Cargo\n",
1818
+ "Media cargo is all images we downloaded from EOL 29 July 2023, so should match to `predicted-catalog`."
1819
+ ]
1820
+ },
1821
+ {
1822
+ "cell_type": "code",
1823
+ "execution_count": 19,
1824
+ "metadata": {},
1825
+ "outputs": [
1826
+ {
1827
+ "name": "stdout",
1828
+ "output_type": "stream",
1829
+ "text": [
1830
+ "<class 'pandas.core.frame.DataFrame'>\n",
1831
+ "RangeIndex: 6724838 entries, 0 to 6724837\n",
1832
+ "Data columns (total 3 columns):\n",
1833
+ " # Column Non-Null Count Dtype \n",
1834
+ "--- ------ -------------- ----- \n",
1835
+ " 0 EOL content ID 6724838 non-null int64 \n",
1836
+ " 1 EOL page ID 6724838 non-null int64 \n",
1837
+ " 2 URL Type 6724838 non-null object\n",
1838
+ "dtypes: int64(2), object(1)\n",
1839
+ "memory usage: 153.9+ MB\n"
1840
+ ]
1841
+ }
1842
+ ],
1843
+ "source": [
1844
+ "cargo = pd.read_csv(\"../data/eol_media_cargo_names.csv\")\n",
1845
+ "cargo.info(show_counts = True)"
1846
+ ]
1847
+ },
1848
+ {
1849
+ "cell_type": "code",
1850
+ "execution_count": 20,
1851
+ "metadata": {},
1852
+ "outputs": [
1853
+ {
1854
+ "data": {
1855
+ "text/plain": [
1856
+ "EOL content ID 6724838\n",
1857
+ "EOL page ID 580866\n",
1858
+ "URL Type 1\n",
1859
+ "dtype: int64"
1860
+ ]
1861
+ },
1862
+ "execution_count": 20,
1863
+ "metadata": {},
1864
+ "output_type": "execute_result"
1865
+ }
1866
+ ],
1867
+ "source": [
1868
+ "cargo.nunique()"
1869
+ ]
1870
+ },
1871
+ {
1872
+ "cell_type": "code",
1873
+ "execution_count": 21,
1874
+ "metadata": {},
1875
+ "outputs": [
1876
+ {
1877
+ "data": {
1878
+ "text/html": [
1879
+ "<div>\n",
1880
+ "<style scoped>\n",
1881
+ " .dataframe tbody tr th:only-of-type {\n",
1882
+ " vertical-align: middle;\n",
1883
+ " }\n",
1884
+ "\n",
1885
+ " .dataframe tbody tr th {\n",
1886
+ " vertical-align: top;\n",
1887
+ " }\n",
1888
+ "\n",
1889
+ " .dataframe thead th {\n",
1890
+ " text-align: right;\n",
1891
+ " }\n",
1892
+ "</style>\n",
1893
+ "<table border=\"1\" class=\"dataframe\">\n",
1894
+ " <thead>\n",
1895
+ " <tr style=\"text-align: right;\">\n",
1896
+ " <th></th>\n",
1897
+ " <th>EOL content ID</th>\n",
1898
+ " <th>EOL page ID</th>\n",
1899
+ " <th>URL Type</th>\n",
1900
+ " </tr>\n",
1901
+ " </thead>\n",
1902
+ " <tbody>\n",
1903
+ " <tr>\n",
1904
+ " <th>0</th>\n",
1905
+ " <td>29538374</td>\n",
1906
+ " <td>65414274</td>\n",
1907
+ " <td>eol-full-size-copy</td>\n",
1908
+ " </tr>\n",
1909
+ " <tr>\n",
1910
+ " <th>1</th>\n",
1911
+ " <td>27793900</td>\n",
1912
+ " <td>888015</td>\n",
1913
+ " <td>eol-full-size-copy</td>\n",
1914
+ " </tr>\n",
1915
+ " <tr>\n",
1916
+ " <th>2</th>\n",
1917
+ " <td>29121641</td>\n",
1918
+ " <td>5618956</td>\n",
1919
+ " <td>eol-full-size-copy</td>\n",
1920
+ " </tr>\n",
1921
+ " <tr>\n",
1922
+ " <th>3</th>\n",
1923
+ " <td>27596176</td>\n",
1924
+ " <td>607817</td>\n",
1925
+ " <td>eol-full-size-copy</td>\n",
1926
+ " </tr>\n",
1927
+ " <tr>\n",
1928
+ " <th>4</th>\n",
1929
+ " <td>20300703</td>\n",
1930
+ " <td>267922</td>\n",
1931
+ " <td>eol-full-size-copy</td>\n",
1932
+ " </tr>\n",
1933
+ " </tbody>\n",
1934
+ "</table>\n",
1935
+ "</div>"
1936
+ ],
1937
+ "text/plain": [
1938
+ " EOL content ID EOL page ID URL Type\n",
1939
+ "0 29538374 65414274 eol-full-size-copy\n",
1940
+ "1 27793900 888015 eol-full-size-copy\n",
1941
+ "2 29121641 5618956 eol-full-size-copy\n",
1942
+ "3 27596176 607817 eol-full-size-copy\n",
1943
+ "4 20300703 267922 eol-full-size-copy"
1944
+ ]
1945
+ },
1946
+ "execution_count": 21,
1947
+ "metadata": {},
1948
+ "output_type": "execute_result"
1949
+ }
1950
+ ],
1951
+ "source": [
1952
+ "cargo.head()"
1953
+ ]
1954
+ },
1955
+ {
1956
+ "cell_type": "code",
1957
+ "execution_count": 24,
1958
+ "metadata": {},
1959
+ "outputs": [],
1960
+ "source": [
1961
+ "cargo.rename(columns = {\"EOL content ID\": \"eol_content_id\"}, inplace = True)\n",
1962
+ "eol_df_cargo = pd.merge(eol_license_df, cargo, how = \"left\", on = \"eol_content_id\")"
1963
+ ]
1964
+ },
1965
+ {
1966
+ "cell_type": "code",
1967
+ "execution_count": 25,
1968
+ "metadata": {},
1969
+ "outputs": [
1970
+ {
1971
+ "name": "stdout",
1972
+ "output_type": "stream",
1973
+ "text": [
1974
+ "<class 'pandas.core.frame.DataFrame'>\n",
1975
+ "RangeIndex: 6277374 entries, 0 to 6277373\n",
1976
+ "Data columns (total 5 columns):\n",
1977
+ " # Column Non-Null Count Dtype \n",
1978
+ "--- ------ -------------- ----- \n",
1979
+ " 0 treeoflife_id 6277374 non-null object \n",
1980
+ " 1 eol_content_id 6277374 non-null float64\n",
1981
+ " 2 eol_page_id 6277374 non-null float64\n",
1982
+ " 3 EOL page ID 6276741 non-null float64\n",
1983
+ " 4 URL Type 6276741 non-null object \n",
1984
+ "dtypes: float64(3), object(2)\n",
1985
+ "memory usage: 239.5+ MB\n"
1986
+ ]
1987
+ }
1988
+ ],
1989
+ "source": [
1990
+ "eol_df_cargo.info(show_counts = True)"
1991
+ ]
1992
+ },
1993
+ {
1994
+ "cell_type": "markdown",
1995
+ "metadata": {},
1996
+ "source": [
1997
+ "There seem to be 633 images here that aren't listed in the media cargo.\n",
1998
+ "\n",
1999
+ "What about in catalog?"
2000
+ ]
2001
+ },
2002
+ {
2003
+ "cell_type": "code",
2004
+ "execution_count": 27,
2005
+ "metadata": {},
2006
+ "outputs": [
2007
+ {
2008
+ "name": "stdout",
2009
+ "output_type": "stream",
2010
+ "text": [
2011
+ "<class 'pandas.core.frame.DataFrame'>\n",
2012
+ "RangeIndex: 6250420 entries, 0 to 6250419\n",
2013
+ "Data columns (total 5 columns):\n",
2014
+ " # Column Non-Null Count Dtype \n",
2015
+ "--- ------ -------------- ----- \n",
2016
+ " 0 treeoflife_id 6250420 non-null object \n",
2017
+ " 1 eol_content_id 6250420 non-null float64\n",
2018
+ " 2 eol_page_id 6250420 non-null float64\n",
2019
+ " 3 EOL page ID 6249787 non-null float64\n",
2020
+ " 4 URL Type 6249787 non-null object \n",
2021
+ "dtypes: float64(3), object(2)\n",
2022
+ "memory usage: 238.4+ MB\n"
2023
+ ]
2024
+ }
2025
+ ],
2026
+ "source": [
2027
+ "eol_cat_cargo = pd.merge(eol_cat_df[eol_license_cols], cargo, how = \"left\", on = \"eol_content_id\")\n",
2028
+ "eol_cat_cargo.info(show_counts = True)"
2029
+ ]
2030
+ },
2031
+ {
2032
+ "cell_type": "markdown",
2033
+ "metadata": {},
2034
+ "source": [
2035
+ "Still missing 633 images...so we know it's not part of the Rare Species dataset, but is TreeOfLife-10M..."
2036
+ ]
2037
+ },
2038
+ {
2039
+ "cell_type": "code",
2040
+ "execution_count": 26,
2041
+ "metadata": {},
2042
+ "outputs": [
2043
+ {
2044
+ "name": "stdout",
2045
+ "output_type": "stream",
2046
+ "text": [
2047
+ "<class 'pandas.core.frame.DataFrame'>\n",
2048
+ "RangeIndex: 6574224 entries, 0 to 6574223\n",
2049
+ "Data columns (total 8 columns):\n",
2050
+ " # Column Non-Null Count Dtype \n",
2051
+ "--- ------ -------------- ----- \n",
2052
+ " 0 eol_content_id 6574224 non-null int64 \n",
2053
+ " 1 EOL page ID_x 6547356 non-null float64\n",
2054
+ " 2 URL Type 6547356 non-null object \n",
2055
+ " 3 EOL page ID_y 6574224 non-null int64 \n",
2056
+ " 4 Medium Source URL 6574222 non-null object \n",
2057
+ " 5 EOL Full-Size Copy URL 6574224 non-null object \n",
2058
+ " 6 License Name 6574224 non-null object \n",
2059
+ " 7 Copyright Owner 5942181 non-null object \n",
2060
+ "dtypes: float64(1), int64(2), object(5)\n",
2061
+ "memory usage: 401.3+ MB\n"
2062
+ ]
2063
+ }
2064
+ ],
2065
+ "source": [
2066
+ "media_in_cargo = pd.merge(cargo, media, how = \"right\", on = \"eol_content_id\")\n",
2067
+ "media_in_cargo.info(show_counts = True)"
2068
+ ]
2069
+ },
2070
+ {
2071
+ "cell_type": "markdown",
2072
+ "metadata": {},
2073
+ "source": [
2074
+ "But there are 26,868 images in media manifest that are not in cargo (or at least the content ID's aren't), despite the media cargo having 154K more images listed."
2075
+ ]
2076
+ },
2077
+ {
2078
+ "cell_type": "code",
2079
+ "execution_count": null,
2080
+ "metadata": {},
2081
+ "outputs": [],
2082
+ "source": []
2083
+ },
2084
+ {
2085
+ "cell_type": "code",
2086
+ "execution_count": null,
2087
+ "metadata": {},
2088
+ "outputs": [],
2089
+ "source": []
2090
+ },
2091
  {
2092
  "cell_type": "markdown",
2093
  "metadata": {},
notebooks/ToL_license_check.py CHANGED
@@ -217,6 +217,50 @@ eol_cat_df_taxa_media.loc[eol_cat_df_taxa_media["Medium Source URL"].isna()].inf
217
  # %%
218
  eol_cat_df_taxa_media.loc[eol_cat_df_taxa_media["Medium Source URL"].isna()].sample(4)
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  # %% [markdown]
221
  # ## Check EOL License file(s)
222
  #
 
217
  # %%
218
  eol_cat_df_taxa_media.loc[eol_cat_df_taxa_media["Medium Source URL"].isna()].sample(4)
219
 
220
+ # %% [markdown]
221
+ # ## Compare Media Cargo
222
+ # Media cargo is all images we downloaded from EOL 29 July 2023, so should match to `predicted-catalog`.
223
+
224
+ # %%
225
+ cargo = pd.read_csv("../data/eol_media_cargo_names.csv")
226
+ cargo.info(show_counts = True)
227
+
228
+ # %%
229
+ cargo.nunique()
230
+
231
+ # %%
232
+ cargo.head()
233
+
234
+ # %%
235
+ cargo.rename(columns = {"EOL content ID": "eol_content_id"}, inplace = True)
236
+ eol_df_cargo = pd.merge(eol_license_df, cargo, how = "left", on = "eol_content_id")
237
+
238
+ # %%
239
+ eol_df_cargo.info(show_counts = True)
240
+
241
+ # %% [markdown]
242
+ # There seem to be 633 images here that aren't listed in the media cargo.
243
+ #
244
+ # What about in catalog?
245
+
246
+ # %%
247
+ eol_cat_cargo = pd.merge(eol_cat_df[eol_license_cols], cargo, how = "left", on = "eol_content_id")
248
+ eol_cat_cargo.info(show_counts = True)
249
+
250
+ # %% [markdown]
251
+ # Still missing 633 images...so we know it's not part of the Rare Species dataset, but is TreeOfLife-10M...
252
+
253
+ # %%
254
+ media_in_cargo = pd.merge(cargo, media, how = "right", on = "eol_content_id")
255
+ media_in_cargo.info(show_counts = True)
256
+
257
+ # %% [markdown]
258
+ # But there are 26,868 images in media manifest that are not in cargo (or at least the content ID's aren't), despite the media cargo having 154K more images listed.
259
+
260
+ # %%
261
+
262
+ # %%
263
+
264
  # %% [markdown]
265
  # ## Check EOL License file(s)
266
  #