egrace479 commited on
Commit
f3017f6
·
1 Parent(s): a057b25

Check media manifests from July 6 and 26 to confirm coverage of all listed images; 113K missing link to media manifest.

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_88306/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": 3,
294
  "metadata": {},
295
  "outputs": [],
296
  "source": [
@@ -309,7 +309,7 @@
309
  },
310
  {
311
  "cell_type": "code",
312
- "execution_count": 4,
313
  "metadata": {},
314
  "outputs": [],
315
  "source": [
@@ -318,7 +318,7 @@
318
  },
319
  {
320
  "cell_type": "code",
321
- "execution_count": 5,
322
  "metadata": {},
323
  "outputs": [
324
  {
@@ -509,7 +509,7 @@
509
  "4 EOL "
510
  ]
511
  },
512
- "execution_count": 5,
513
  "metadata": {},
514
  "output_type": "execute_result"
515
  }
@@ -527,51 +527,260 @@
527
  },
528
  {
529
  "cell_type": "code",
530
- "execution_count": 6,
531
  "metadata": {},
532
  "outputs": [
533
  {
534
  "data": {
535
  "text/plain": [
536
- "Index(['split', 'treeoflife_id', 'eol_content_id', 'eol_page_id'], dtype='object')"
537
  ]
538
  },
539
- "execution_count": 6,
540
  "metadata": {},
541
  "output_type": "execute_result"
542
  }
543
  ],
544
  "source": [
545
- "eol_license_cols = eol_df.columns[:4]\n",
546
  "eol_license_cols"
547
  ]
548
  },
549
  {
550
  "cell_type": "code",
551
- "execution_count": 8,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
552
  "metadata": {},
553
  "outputs": [
554
  {
555
  "name": "stderr",
556
  "output_type": "stream",
557
  "text": [
558
- "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_88306/3674968623.py:2: SettingWithCopyWarning: \n",
559
- "A value is trying to be set on a copy of a slice from a DataFrame.\n",
560
- "Try using .loc[row_indexer,col_indexer] = value instead\n",
561
- "\n",
562
- "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
563
- " eol_license_df[\"license\"] = None\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  ]
565
  }
566
  ],
567
  "source": [
568
- "eol_license_df = eol_df[eol_license_cols]\n",
569
- "eol_license_df[\"license\"] = None"
570
  ]
571
  },
572
  {
573
  "cell_type": "code",
574
- "execution_count": 9,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  "metadata": {},
576
  "outputs": [
577
  {
@@ -595,90 +804,353 @@
595
  " <thead>\n",
596
  " <tr style=\"text-align: right;\">\n",
597
  " <th></th>\n",
598
- " <th>split</th>\n",
599
  " <th>treeoflife_id</th>\n",
600
  " <th>eol_content_id</th>\n",
601
  " <th>eol_page_id</th>\n",
602
- " <th>license</th>\n",
 
 
 
 
603
  " </tr>\n",
604
  " </thead>\n",
605
  " <tbody>\n",
606
  " <tr>\n",
607
  " <th>0</th>\n",
608
- " <td>train</td>\n",
609
  " <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
610
  " <td>22131926.0</td>\n",
611
  " <td>269504.0</td>\n",
612
- " <td>None</td>\n",
 
 
 
 
613
  " </tr>\n",
614
  " <tr>\n",
615
  " <th>1</th>\n",
616
- " <td>train</td>\n",
617
  " <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
618
  " <td>22291283.0</td>\n",
619
  " <td>6101931.0</td>\n",
620
- " <td>None</td>\n",
 
 
 
 
621
  " </tr>\n",
622
  " <tr>\n",
623
  " <th>2</th>\n",
624
- " <td>train</td>\n",
625
  " <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
626
  " <td>21802775.0</td>\n",
627
  " <td>45513632.0</td>\n",
628
- " <td>None</td>\n",
 
 
 
 
629
  " </tr>\n",
630
  " <tr>\n",
631
  " <th>3</th>\n",
632
- " <td>train</td>\n",
633
  " <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
634
  " <td>12784812.0</td>\n",
635
  " <td>51655800.0</td>\n",
636
- " <td>None</td>\n",
 
 
 
 
637
  " </tr>\n",
638
  " <tr>\n",
639
  " <th>4</th>\n",
640
- " <td>train</td>\n",
641
  " <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
642
  " <td>29713643.0</td>\n",
643
  " <td>45515896.0</td>\n",
644
- " <td>None</td>\n",
 
 
 
 
645
  " </tr>\n",
646
  " </tbody>\n",
647
  "</table>\n",
648
  "</div>"
649
  ],
650
  "text/plain": [
651
- " split treeoflife_id eol_content_id eol_page_id \n",
652
- "0 train f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0 \\\n",
653
- "1 train 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0 \n",
654
- "2 train 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0 \n",
655
- "3 train 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0 \n",
656
- "4 train f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0 \n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  "\n",
658
- " license \n",
659
- "0 None \n",
660
- "1 None \n",
661
- "2 None \n",
662
- "3 None \n",
663
- "4 None "
664
  ]
665
  },
666
- "execution_count": 9,
667
  "metadata": {},
668
  "output_type": "execute_result"
669
  }
670
  ],
671
  "source": [
672
- "eol_license_df.head()"
 
 
 
 
 
 
 
 
673
  ]
674
  },
675
  {
676
  "cell_type": "code",
677
- "execution_count": 11,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  "metadata": {},
679
  "outputs": [],
680
  "source": [
681
- "eol_license_df.to_csv(\"../data/eol_licenses.csv\", index = False)"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
682
  ]
683
  },
684
  {
 
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
  },
291
  {
292
  "cell_type": "code",
293
+ "execution_count": 5,
294
  "metadata": {},
295
  "outputs": [],
296
  "source": [
 
309
  },
310
  {
311
  "cell_type": "code",
312
+ "execution_count": 6,
313
  "metadata": {},
314
  "outputs": [],
315
  "source": [
 
318
  },
319
  {
320
  "cell_type": "code",
321
+ "execution_count": 7,
322
  "metadata": {},
323
  "outputs": [
324
  {
 
509
  "4 EOL "
510
  ]
511
  },
512
+ "execution_count": 7,
513
  "metadata": {},
514
  "output_type": "execute_result"
515
  }
 
527
  },
528
  {
529
  "cell_type": "code",
530
+ "execution_count": 9,
531
  "metadata": {},
532
  "outputs": [
533
  {
534
  "data": {
535
  "text/plain": [
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
  }
543
  ],
544
  "source": [
545
+ "eol_license_cols = eol_df.columns[1:4]\n",
546
  "eol_license_cols"
547
  ]
548
  },
549
  {
550
  "cell_type": "code",
551
+ "execution_count": 10,
552
+ "metadata": {},
553
+ "outputs": [],
554
+ "source": [
555
+ "eol_license_df = eol_df[eol_license_cols]\n",
556
+ "#eol_license_df[\"license\"] = None"
557
+ ]
558
+ },
559
+ {
560
+ "cell_type": "code",
561
+ "execution_count": 11,
562
+ "metadata": {},
563
+ "outputs": [
564
+ {
565
+ "data": {
566
+ "text/html": [
567
+ "<div>\n",
568
+ "<style scoped>\n",
569
+ " .dataframe tbody tr th:only-of-type {\n",
570
+ " vertical-align: middle;\n",
571
+ " }\n",
572
+ "\n",
573
+ " .dataframe tbody tr th {\n",
574
+ " vertical-align: top;\n",
575
+ " }\n",
576
+ "\n",
577
+ " .dataframe thead th {\n",
578
+ " text-align: right;\n",
579
+ " }\n",
580
+ "</style>\n",
581
+ "<table border=\"1\" class=\"dataframe\">\n",
582
+ " <thead>\n",
583
+ " <tr style=\"text-align: right;\">\n",
584
+ " <th></th>\n",
585
+ " <th>treeoflife_id</th>\n",
586
+ " <th>eol_content_id</th>\n",
587
+ " <th>eol_page_id</th>\n",
588
+ " </tr>\n",
589
+ " </thead>\n",
590
+ " <tbody>\n",
591
+ " <tr>\n",
592
+ " <th>0</th>\n",
593
+ " <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
594
+ " <td>22131926.0</td>\n",
595
+ " <td>269504.0</td>\n",
596
+ " </tr>\n",
597
+ " <tr>\n",
598
+ " <th>1</th>\n",
599
+ " <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
600
+ " <td>22291283.0</td>\n",
601
+ " <td>6101931.0</td>\n",
602
+ " </tr>\n",
603
+ " <tr>\n",
604
+ " <th>2</th>\n",
605
+ " <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
606
+ " <td>21802775.0</td>\n",
607
+ " <td>45513632.0</td>\n",
608
+ " </tr>\n",
609
+ " <tr>\n",
610
+ " <th>3</th>\n",
611
+ " <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
612
+ " <td>12784812.0</td>\n",
613
+ " <td>51655800.0</td>\n",
614
+ " </tr>\n",
615
+ " <tr>\n",
616
+ " <th>4</th>\n",
617
+ " <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
618
+ " <td>29713643.0</td>\n",
619
+ " <td>45515896.0</td>\n",
620
+ " </tr>\n",
621
+ " </tbody>\n",
622
+ "</table>\n",
623
+ "</div>"
624
+ ],
625
+ "text/plain": [
626
+ " treeoflife_id eol_content_id eol_page_id\n",
627
+ "0 f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0\n",
628
+ "1 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0\n",
629
+ "2 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0\n",
630
+ "3 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0\n",
631
+ "4 f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0"
632
+ ]
633
+ },
634
+ "execution_count": 11,
635
+ "metadata": {},
636
+ "output_type": "execute_result"
637
+ }
638
+ ],
639
+ "source": [
640
+ "eol_license_df.head()"
641
+ ]
642
+ },
643
+ {
644
+ "cell_type": "code",
645
+ "execution_count": 11,
646
+ "metadata": {},
647
+ "outputs": [],
648
+ "source": [
649
+ "#eol_license_df.to_csv(\"../data/eol_licenses.csv\", index = False)"
650
+ ]
651
+ },
652
+ {
653
+ "cell_type": "markdown",
654
+ "metadata": {},
655
+ "source": [
656
+ "### Merge with Media Manifest to Check for Licenses\n",
657
+ "Previous license files (retained below) are missing files, let's merge with the [media manifest](https://huggingface.co/datasets/imageomics/eol/blob/be7b7e6c372f6547e30030e9576d9cc638320099/data/interim/media_manifest.csv) all these images should have been downloaded from to see if there are any here that don't exist in it. From there we'll check licensing info."
658
+ ]
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
+ },
673
+ {
674
+ "name": "stdout",
675
+ "output_type": "stream",
676
+ "text": [
677
+ "<class 'pandas.core.frame.DataFrame'>\n",
678
+ "RangeIndex: 6574224 entries, 0 to 6574223\n",
679
+ "Data columns (total 6 columns):\n",
680
+ " # Column Non-Null Count Dtype \n",
681
+ "--- ------ -------------- ----- \n",
682
+ " 0 EOL content ID 6574224 non-null int64 \n",
683
+ " 1 EOL page ID 6574224 non-null int64 \n",
684
+ " 2 Medium Source URL 6574222 non-null object\n",
685
+ " 3 EOL Full-Size Copy URL 6574224 non-null object\n",
686
+ " 4 License Name 6574224 non-null object\n",
687
+ " 5 Copyright Owner 5942181 non-null object\n",
688
+ "dtypes: int64(2), object(4)\n",
689
+ "memory usage: 300.9+ MB\n"
690
  ]
691
  }
692
  ],
693
  "source": [
694
+ "media = pd.read_csv(\"../data/media_manifest (july 26).csv\")\n",
695
+ "media.info(show_counts = True)"
696
  ]
697
  },
698
  {
699
  "cell_type": "code",
700
+ "execution_count": 19,
701
+ "metadata": {},
702
+ "outputs": [
703
+ {
704
+ "data": {
705
+ "text/plain": [
706
+ "(6277374, 3)"
707
+ ]
708
+ },
709
+ "execution_count": 19,
710
+ "metadata": {},
711
+ "output_type": "execute_result"
712
+ }
713
+ ],
714
+ "source": [
715
+ "eol_license_df.shape"
716
+ ]
717
+ },
718
+ {
719
+ "cell_type": "markdown",
720
+ "metadata": {},
721
+ "source": [
722
+ "Notice that we have about 300K more entries in the media manifest, which is about expected from the [comparison of predicted-catalog to the original full list](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/main/notebooks/ToL_predicted-catalog_EDA.ipynb)."
723
+ ]
724
+ },
725
+ {
726
+ "cell_type": "code",
727
+ "execution_count": 16,
728
+ "metadata": {},
729
+ "outputs": [],
730
+ "source": [
731
+ "media.rename(columns = {\"EOL content ID\": \"eol_content_id\"}, inplace = True)"
732
+ ]
733
+ },
734
+ {
735
+ "cell_type": "code",
736
+ "execution_count": 20,
737
+ "metadata": {},
738
+ "outputs": [],
739
+ "source": [
740
+ "eol_df_media = pd.merge(eol_license_df, media, how = \"left\", on = \"eol_content_id\")"
741
+ ]
742
+ },
743
+ {
744
+ "cell_type": "code",
745
+ "execution_count": 21,
746
+ "metadata": {},
747
+ "outputs": [
748
+ {
749
+ "name": "stdout",
750
+ "output_type": "stream",
751
+ "text": [
752
+ "<class 'pandas.core.frame.DataFrame'>\n",
753
+ "RangeIndex: 6277374 entries, 0 to 6277373\n",
754
+ "Data columns (total 8 columns):\n",
755
+ " # Column Non-Null Count Dtype \n",
756
+ "--- ------ -------------- ----- \n",
757
+ " 0 treeoflife_id 6277374 non-null object \n",
758
+ " 1 eol_content_id 6277374 non-null float64\n",
759
+ " 2 eol_page_id 6277374 non-null float64\n",
760
+ " 3 EOL page ID 6163903 non-null float64\n",
761
+ " 4 Medium Source URL 6163903 non-null object \n",
762
+ " 5 EOL Full-Size Copy URL 6163903 non-null object \n",
763
+ " 6 License Name 6163903 non-null object \n",
764
+ " 7 Copyright Owner 5549428 non-null object \n",
765
+ "dtypes: float64(3), object(5)\n",
766
+ "memory usage: 383.1+ MB\n"
767
+ ]
768
+ }
769
+ ],
770
+ "source": [
771
+ "eol_df_media.info(show_counts = True)"
772
+ ]
773
+ },
774
+ {
775
+ "cell_type": "markdown",
776
+ "metadata": {},
777
+ "source": [
778
+ "Clearly we have about 113K images whose content ID's are not in the media manifest, and thus we'er missing the URL and license info."
779
+ ]
780
+ },
781
+ {
782
+ "cell_type": "code",
783
+ "execution_count": 22,
784
  "metadata": {},
785
  "outputs": [
786
  {
 
804
  " <thead>\n",
805
  " <tr style=\"text-align: right;\">\n",
806
  " <th></th>\n",
 
807
  " <th>treeoflife_id</th>\n",
808
  " <th>eol_content_id</th>\n",
809
  " <th>eol_page_id</th>\n",
810
+ " <th>EOL page ID</th>\n",
811
+ " <th>Medium Source URL</th>\n",
812
+ " <th>EOL Full-Size Copy URL</th>\n",
813
+ " <th>License Name</th>\n",
814
+ " <th>Copyright Owner</th>\n",
815
  " </tr>\n",
816
  " </thead>\n",
817
  " <tbody>\n",
818
  " <tr>\n",
819
  " <th>0</th>\n",
 
820
  " <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
821
  " <td>22131926.0</td>\n",
822
  " <td>269504.0</td>\n",
823
+ " <td>269504.0</td>\n",
824
+ " <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
825
+ " <td>https://content.eol.org/data/media/6a/ed/7a/18...</td>\n",
826
+ " <td>cc-by-nc-4.0</td>\n",
827
+ " <td>洪廷維</td>\n",
828
  " </tr>\n",
829
  " <tr>\n",
830
  " <th>1</th>\n",
 
831
  " <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
832
  " <td>22291283.0</td>\n",
833
  " <td>6101931.0</td>\n",
834
+ " <td>6101931.0</td>\n",
835
+ " <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
836
+ " <td>https://content.eol.org/data/media/7b/bc/92/18...</td>\n",
837
+ " <td>cc-by-nc-4.0</td>\n",
838
+ " <td>Игорь Поспелов</td>\n",
839
  " </tr>\n",
840
  " <tr>\n",
841
  " <th>2</th>\n",
 
842
  " <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
843
  " <td>21802775.0</td>\n",
844
  " <td>45513632.0</td>\n",
845
+ " <td>45513632.0</td>\n",
846
+ " <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
847
+ " <td>https://content.eol.org/data/media/66/be/16/18...</td>\n",
848
+ " <td>cc-by-nc-4.0</td>\n",
849
+ " <td>Marina Gorbunova</td>\n",
850
  " </tr>\n",
851
  " <tr>\n",
852
  " <th>3</th>\n",
 
853
  " <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
854
  " <td>12784812.0</td>\n",
855
  " <td>51655800.0</td>\n",
856
+ " <td>51655800.0</td>\n",
857
+ " <td>http://www.femorale.com/shellphotos/photos15/3...</td>\n",
858
+ " <td>https://content.eol.org/data/media/c4/79/dc/14...</td>\n",
859
+ " <td>cc-by-nc</td>\n",
860
+ " <td>Femorale</td>\n",
861
  " </tr>\n",
862
  " <tr>\n",
863
  " <th>4</th>\n",
 
864
  " <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
865
  " <td>29713643.0</td>\n",
866
  " <td>45515896.0</td>\n",
867
+ " <td>45515896.0</td>\n",
868
+ " <td>https://upload.wikimedia.org/wikipedia/commons...</td>\n",
869
+ " <td>https://content.eol.org/data/media/5f/ef/95/50...</td>\n",
870
+ " <td>cc-by-sa-3.0</td>\n",
871
+ " <td>NaN</td>\n",
872
  " </tr>\n",
873
  " </tbody>\n",
874
  "</table>\n",
875
  "</div>"
876
  ],
877
  "text/plain": [
878
+ " treeoflife_id eol_content_id eol_page_id \n",
879
+ "0 f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0 \\\n",
880
+ "1 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0 \n",
881
+ "2 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0 \n",
882
+ "3 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0 \n",
883
+ "4 f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0 \n",
884
+ "\n",
885
+ " EOL page ID Medium Source URL \n",
886
+ "0 269504.0 https://inaturalist-open-data.s3.amazonaws.com... \\\n",
887
+ "1 6101931.0 https://inaturalist-open-data.s3.amazonaws.com... \n",
888
+ "2 45513632.0 https://inaturalist-open-data.s3.amazonaws.com... \n",
889
+ "3 51655800.0 http://www.femorale.com/shellphotos/photos15/3... \n",
890
+ "4 45515896.0 https://upload.wikimedia.org/wikipedia/commons... \n",
891
+ "\n",
892
+ " EOL Full-Size Copy URL License Name \n",
893
+ "0 https://content.eol.org/data/media/6a/ed/7a/18... cc-by-nc-4.0 \\\n",
894
+ "1 https://content.eol.org/data/media/7b/bc/92/18... cc-by-nc-4.0 \n",
895
+ "2 https://content.eol.org/data/media/66/be/16/18... cc-by-nc-4.0 \n",
896
+ "3 https://content.eol.org/data/media/c4/79/dc/14... cc-by-nc \n",
897
+ "4 https://content.eol.org/data/media/5f/ef/95/50... cc-by-sa-3.0 \n",
898
  "\n",
899
+ " Copyright Owner \n",
900
+ "0 洪廷維 \n",
901
+ "1 Игорь Поспелов \n",
902
+ "2 Marina Gorbunova \n",
903
+ "3 Femorale \n",
904
+ "4 NaN "
905
  ]
906
  },
907
+ "execution_count": 22,
908
  "metadata": {},
909
  "output_type": "execute_result"
910
  }
911
  ],
912
  "source": [
913
+ "eol_df_media.head()"
914
+ ]
915
+ },
916
+ {
917
+ "cell_type": "markdown",
918
+ "metadata": {},
919
+ "source": [
920
+ "### Save Record of Missing Content IDs & Compare to Older Media Manifest\n",
921
+ "Let's save a record of the missing content IDs, then we'll compare them to the [July 6 media manifest](https://huggingface.co/datasets/imageomics/eol/blob/eaa00a48fa188f12906c5b8074d60aa8e67eb135/data/interim/media_manifest.csv) to see if any are in there. The July 6 media manifest is smaller, but we'll still check."
922
  ]
923
  },
924
  {
925
  "cell_type": "code",
926
+ "execution_count": 23,
927
+ "metadata": {},
928
+ "outputs": [
929
+ {
930
+ "data": {
931
+ "text/html": [
932
+ "<div>\n",
933
+ "<style scoped>\n",
934
+ " .dataframe tbody tr th:only-of-type {\n",
935
+ " vertical-align: middle;\n",
936
+ " }\n",
937
+ "\n",
938
+ " .dataframe tbody tr th {\n",
939
+ " vertical-align: top;\n",
940
+ " }\n",
941
+ "\n",
942
+ " .dataframe thead th {\n",
943
+ " text-align: right;\n",
944
+ " }\n",
945
+ "</style>\n",
946
+ "<table border=\"1\" class=\"dataframe\">\n",
947
+ " <thead>\n",
948
+ " <tr style=\"text-align: right;\">\n",
949
+ " <th></th>\n",
950
+ " <th>treeoflife_id</th>\n",
951
+ " <th>eol_content_id</th>\n",
952
+ " <th>eol_page_id</th>\n",
953
+ " <th>EOL page ID</th>\n",
954
+ " <th>Medium Source URL</th>\n",
955
+ " <th>EOL Full-Size Copy URL</th>\n",
956
+ " <th>License Name</th>\n",
957
+ " <th>Copyright Owner</th>\n",
958
+ " </tr>\n",
959
+ " </thead>\n",
960
+ " <tbody>\n",
961
+ " <tr>\n",
962
+ " <th>126</th>\n",
963
+ " <td>4b56e165-c4d5-49f9-a321-ac9474d099f3</td>\n",
964
+ " <td>2753529.0</td>\n",
965
+ " <td>1225965.0</td>\n",
966
+ " <td>NaN</td>\n",
967
+ " <td>NaN</td>\n",
968
+ " <td>NaN</td>\n",
969
+ " <td>NaN</td>\n",
970
+ " <td>NaN</td>\n",
971
+ " </tr>\n",
972
+ " <tr>\n",
973
+ " <th>174</th>\n",
974
+ " <td>421678a0-c8ec-43c8-815c-fc5888835068</td>\n",
975
+ " <td>16288.0</td>\n",
976
+ " <td>45514264.0</td>\n",
977
+ " <td>NaN</td>\n",
978
+ " <td>NaN</td>\n",
979
+ " <td>NaN</td>\n",
980
+ " <td>NaN</td>\n",
981
+ " <td>NaN</td>\n",
982
+ " </tr>\n",
983
+ " <tr>\n",
984
+ " <th>177</th>\n",
985
+ " <td>be81bd8c-16a7-4911-8279-431245d67195</td>\n",
986
+ " <td>2730639.0</td>\n",
987
+ " <td>1034220.0</td>\n",
988
+ " <td>NaN</td>\n",
989
+ " <td>NaN</td>\n",
990
+ " <td>NaN</td>\n",
991
+ " <td>NaN</td>\n",
992
+ " <td>NaN</td>\n",
993
+ " </tr>\n",
994
+ " <tr>\n",
995
+ " <th>259</th>\n",
996
+ " <td>fc765c82-84e6-437e-b9a5-1c7601c5be81</td>\n",
997
+ " <td>2717906.0</td>\n",
998
+ " <td>1052077.0</td>\n",
999
+ " <td>NaN</td>\n",
1000
+ " <td>NaN</td>\n",
1001
+ " <td>NaN</td>\n",
1002
+ " <td>NaN</td>\n",
1003
+ " <td>NaN</td>\n",
1004
+ " </tr>\n",
1005
+ " <tr>\n",
1006
+ " <th>322</th>\n",
1007
+ " <td>8c1e6878-47ac-4f7b-8475-73e71c0e99c3</td>\n",
1008
+ " <td>2836995.0</td>\n",
1009
+ " <td>957074.0</td>\n",
1010
+ " <td>NaN</td>\n",
1011
+ " <td>NaN</td>\n",
1012
+ " <td>NaN</td>\n",
1013
+ " <td>NaN</td>\n",
1014
+ " <td>NaN</td>\n",
1015
+ " </tr>\n",
1016
+ " </tbody>\n",
1017
+ "</table>\n",
1018
+ "</div>"
1019
+ ],
1020
+ "text/plain": [
1021
+ " treeoflife_id eol_content_id eol_page_id \n",
1022
+ "126 4b56e165-c4d5-49f9-a321-ac9474d099f3 2753529.0 1225965.0 \\\n",
1023
+ "174 421678a0-c8ec-43c8-815c-fc5888835068 16288.0 45514264.0 \n",
1024
+ "177 be81bd8c-16a7-4911-8279-431245d67195 2730639.0 1034220.0 \n",
1025
+ "259 fc765c82-84e6-437e-b9a5-1c7601c5be81 2717906.0 1052077.0 \n",
1026
+ "322 8c1e6878-47ac-4f7b-8475-73e71c0e99c3 2836995.0 957074.0 \n",
1027
+ "\n",
1028
+ " EOL page ID Medium Source URL EOL Full-Size Copy URL License Name \n",
1029
+ "126 NaN NaN NaN NaN \\\n",
1030
+ "174 NaN NaN NaN NaN \n",
1031
+ "177 NaN NaN NaN NaN \n",
1032
+ "259 NaN NaN NaN NaN \n",
1033
+ "322 NaN NaN NaN NaN \n",
1034
+ "\n",
1035
+ " Copyright Owner \n",
1036
+ "126 NaN \n",
1037
+ "174 NaN \n",
1038
+ "177 NaN \n",
1039
+ "259 NaN \n",
1040
+ "322 NaN "
1041
+ ]
1042
+ },
1043
+ "execution_count": 23,
1044
+ "metadata": {},
1045
+ "output_type": "execute_result"
1046
+ }
1047
+ ],
1048
+ "source": [
1049
+ "eol_missing_content_ids = eol_df_media.loc[eol_df_media[\"Medium Source URL\"].isna()]\n",
1050
+ "eol_missing_content_ids.head()"
1051
+ ]
1052
+ },
1053
+ {
1054
+ "cell_type": "code",
1055
+ "execution_count": 24,
1056
  "metadata": {},
1057
  "outputs": [],
1058
  "source": [
1059
+ "eol_missing_content_ids.to_csv(\"../data/eol_missing_content_ids.csv\", index = False)"
1060
+ ]
1061
+ },
1062
+ {
1063
+ "cell_type": "code",
1064
+ "execution_count": 25,
1065
+ "metadata": {},
1066
+ "outputs": [
1067
+ {
1068
+ "name": "stderr",
1069
+ "output_type": "stream",
1070
+ "text": [
1071
+ "/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_74901/610094471.py:1: DtypeWarning: Columns (0,1) have mixed types. Specify dtype option on import or set low_memory=False.\n",
1072
+ " media_old = pd.read_csv(\"../data/media_manifest.csv\")\n"
1073
+ ]
1074
+ },
1075
+ {
1076
+ "name": "stdout",
1077
+ "output_type": "stream",
1078
+ "text": [
1079
+ "<class 'pandas.core.frame.DataFrame'>\n",
1080
+ "RangeIndex: 5712231 entries, 0 to 5712230\n",
1081
+ "Data columns (total 6 columns):\n",
1082
+ " # Column Non-Null Count Dtype \n",
1083
+ "--- ------ -------------- ----- \n",
1084
+ " 0 EOL content ID 5712231 non-null object\n",
1085
+ " 1 EOL page ID 5712163 non-null object\n",
1086
+ " 2 Medium Source URL 5712163 non-null object\n",
1087
+ " 3 EOL Full-Size Copy URL 5709587 non-null object\n",
1088
+ " 4 License Name 5709587 non-null object\n",
1089
+ " 5 Copyright Owner 4921801 non-null object\n",
1090
+ "dtypes: object(6)\n",
1091
+ "memory usage: 261.5+ MB\n"
1092
+ ]
1093
+ }
1094
+ ],
1095
+ "source": [
1096
+ "media_old = pd.read_csv(\"../data/media_manifest.csv\")\n",
1097
+ "media_old.info(show_counts = True)"
1098
+ ]
1099
+ },
1100
+ {
1101
+ "cell_type": "code",
1102
+ "execution_count": 26,
1103
+ "metadata": {},
1104
+ "outputs": [],
1105
+ "source": [
1106
+ "media_old.rename(columns = {\"EOL content ID\": \"eol_content_id\"}, inplace = True)"
1107
+ ]
1108
+ },
1109
+ {
1110
+ "cell_type": "code",
1111
+ "execution_count": 27,
1112
+ "metadata": {},
1113
+ "outputs": [],
1114
+ "source": [
1115
+ "eol_df_media_old = pd.merge(eol_missing_content_ids[eol_license_cols], media_old, how = \"left\", on = \"eol_content_id\")"
1116
+ ]
1117
+ },
1118
+ {
1119
+ "cell_type": "code",
1120
+ "execution_count": 28,
1121
+ "metadata": {},
1122
+ "outputs": [
1123
+ {
1124
+ "name": "stdout",
1125
+ "output_type": "stream",
1126
+ "text": [
1127
+ "<class 'pandas.core.frame.DataFrame'>\n",
1128
+ "RangeIndex: 113471 entries, 0 to 113470\n",
1129
+ "Data columns (total 8 columns):\n",
1130
+ " # Column Non-Null Count Dtype \n",
1131
+ "--- ------ -------------- ----- \n",
1132
+ " 0 treeoflife_id 113471 non-null object \n",
1133
+ " 1 eol_content_id 113471 non-null object \n",
1134
+ " 2 eol_page_id 113471 non-null float64\n",
1135
+ " 3 EOL page ID 0 non-null object \n",
1136
+ " 4 Medium Source URL 0 non-null object \n",
1137
+ " 5 EOL Full-Size Copy URL 0 non-null object \n",
1138
+ " 6 License Name 0 non-null object \n",
1139
+ " 7 Copyright Owner 0 non-null object \n",
1140
+ "dtypes: float64(1), object(7)\n",
1141
+ "memory usage: 6.9+ MB\n"
1142
+ ]
1143
+ }
1144
+ ],
1145
+ "source": [
1146
+ "eol_df_media_old.info(show_counts = True)"
1147
+ ]
1148
+ },
1149
+ {
1150
+ "cell_type": "markdown",
1151
+ "metadata": {},
1152
+ "source": [
1153
+ "No, we do not have any of the missing ones in the older media manifest."
1154
  ]
1155
  },
1156
  {
notebooks/ToL_license_check.py CHANGED
@@ -60,18 +60,74 @@ eol_df.head()
60
  # We don't need the BIOSCAN or iNat21 columns, nor the taxa columns.
61
 
62
  # %%
63
- eol_license_cols = eol_df.columns[:4]
64
  eol_license_cols
65
 
66
  # %%
67
  eol_license_df = eol_df[eol_license_cols]
68
- eol_license_df["license"] = None
69
 
70
  # %%
71
  eol_license_df.head()
72
 
73
  # %%
74
- eol_license_df.to_csv("../data/eol_licenses.csv", index = False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  # %% [markdown]
77
  # ## Check EOL License file(s)
 
60
  # We don't need the BIOSCAN or iNat21 columns, nor the taxa columns.
61
 
62
  # %%
63
+ eol_license_cols = eol_df.columns[1:4]
64
  eol_license_cols
65
 
66
  # %%
67
  eol_license_df = eol_df[eol_license_cols]
68
+ #eol_license_df["license"] = None
69
 
70
  # %%
71
  eol_license_df.head()
72
 
73
  # %%
74
+ #eol_license_df.to_csv("../data/eol_licenses.csv", index = False)
75
+
76
+ # %% [markdown]
77
+ # ### Merge with Media Manifest to Check for Licenses
78
+ # Previous license files (retained below) are missing files, let's merge with the [media manifest](https://huggingface.co/datasets/imageomics/eol/blob/be7b7e6c372f6547e30030e9576d9cc638320099/data/interim/media_manifest.csv) all these images should have been downloaded from to see if there are any here that don't exist in it. From there we'll check licensing info.
79
+
80
+ # %%
81
+ media = pd.read_csv("../data/media_manifest (july 26).csv")
82
+ media.info(show_counts = True)
83
+
84
+ # %%
85
+ eol_license_df.shape
86
+
87
+ # %% [markdown]
88
+ # Notice that we have about 300K more entries in the media manifest, which is about expected from the [comparison of predicted-catalog to the original full list](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/main/notebooks/ToL_predicted-catalog_EDA.ipynb).
89
+
90
+ # %%
91
+ media.rename(columns = {"EOL content ID": "eol_content_id"}, inplace = True)
92
+
93
+ # %%
94
+ eol_df_media = pd.merge(eol_license_df, media, how = "left", on = "eol_content_id")
95
+
96
+ # %%
97
+ eol_df_media.info(show_counts = True)
98
+
99
+ # %% [markdown]
100
+ # Clearly we have about 113K images whose content ID's are not in the media manifest, and thus we'er missing the URL and license info.
101
+
102
+ # %%
103
+ eol_df_media.head()
104
+
105
+ # %% [markdown]
106
+ # ### Save Record of Missing Content IDs & Compare to Older Media Manifest
107
+ # Let's save a record of the missing content IDs, then we'll compare them to the [July 6 media manifest](https://huggingface.co/datasets/imageomics/eol/blob/eaa00a48fa188f12906c5b8074d60aa8e67eb135/data/interim/media_manifest.csv) to see if any are in there. The July 6 media manifest is smaller, but we'll still check.
108
+
109
+ # %%
110
+ eol_missing_content_ids = eol_df_media.loc[eol_df_media["Medium Source URL"].isna()]
111
+ eol_missing_content_ids.head()
112
+
113
+ # %%
114
+ eol_missing_content_ids.to_csv("../data/eol_missing_content_ids.csv", index = False)
115
+
116
+ # %%
117
+ media_old = pd.read_csv("../data/media_manifest.csv")
118
+ media_old.info(show_counts = True)
119
+
120
+ # %%
121
+ media_old.rename(columns = {"EOL content ID": "eol_content_id"}, inplace = True)
122
+
123
+ # %%
124
+ eol_df_media_old = pd.merge(eol_missing_content_ids[eol_license_cols], media_old, how = "left", on = "eol_content_id")
125
+
126
+ # %%
127
+ eol_df_media_old.info(show_counts = True)
128
+
129
+ # %% [markdown]
130
+ # No, we do not have any of the missing ones in the older media manifest.
131
 
132
  # %% [markdown]
133
  # ## Check EOL License file(s)