v3.3-meta-link
#10
by
egrace479 - opened
- .gitattributes +12 -0
- README.md +40 -9
- data/catalog.csv +2 -2
- data/licenses.csv +3 -0
- eol_realign/data/checksums_media_cargo_archive.csv +3 -0
- eol_realign/data/combined-manifest-licenses.csv +3 -0
- eol_realign/data/combined_manifest.csv +3 -0
- eol_realign/data/combined_manifest_with_checksums.csv +3 -0
- eol_realign/data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv +3 -0
- eol_realign/data/eol-cargo-archive_combined-manifest-checksums_links.csv +3 -0
- eol_realign/data/full_owner_manifest.csv +3 -0
- eol_realign/data/links_cargo_manifest_IDmismatch.csv +3 -0
- eol_realign/data/links_inner.csv +3 -0
- eol_realign/data/links_manifest_cargo_on_md5.csv +3 -0
- eol_realign/data/mismatched_rarespecies.csv +175 -0
- eol_realign/data/rarespecies_full_manifest.csv +0 -0
- eol_realign/data/rs_links.csv +0 -0
- eol_realign/notebooks/catalog-cargo-manifest_test.ipynb +851 -0
- eol_realign/notebooks/links_align_reduced.ipynb +1253 -0
- eol_realign/notebooks/links_align_reduced.py +250 -0
- eol_realign/notebooks/links_rs_duplicates.ipynb +0 -0
- eol_realign/notebooks/links_rs_duplicates.py +536 -0
- eol_realign/notebooks/re-gen_rs_catalog.ipynb +1527 -0
- eol_realign/notebooks/re-gen_tol_catalog.ipynb +926 -0
- eol_realign/scripts/make_licenses.py +101 -0
- eol_realign/scripts/match_owners.py +136 -0
- rare_species/data/licenses.csv +0 -0
- rare_species/data/rarespecies-catalog.csv +3 -0
- rare_species/data/rarespecies_manifest.csv +0 -0
.gitattributes
CHANGED
|
@@ -63,3 +63,15 @@ data/predicted-catalog.csv filter=lfs diff=lfs merge=lfs -text
|
|
| 63 |
notebooks/BioCLIP_taxa_viz.ipynb filter=lfs diff=lfs merge=lfs -text
|
| 64 |
visuals/kingdom_ToL_tree.pdf filter=lfs diff=lfs merge=lfs -text
|
| 65 |
visuals/phyla_ToL_tree.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
notebooks/BioCLIP_taxa_viz.ipynb filter=lfs diff=lfs merge=lfs -text
|
| 64 |
visuals/kingdom_ToL_tree.pdf filter=lfs diff=lfs merge=lfs -text
|
| 65 |
visuals/phyla_ToL_tree.pdf filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
eol_realign/data/links_inner.csv filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
eol_realign/data/links_manifest_cargo_on_md5.csv filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
eol_realign/data/links_cargo_manifest_IDmismatch.csv filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
eol_realign/data/eol-cargo-archive_combined-manifest-checksums_links.csv filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
eol_realign/data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
eol_realign/data/checksums_media_cargo_archive.csv filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
eol_realign/data/combined_manifest_with_checksums.csv filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
eol_realign/data/full_owner_manifest.csv filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
rare_species/data/rarespecies-catalog.csv filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
eol_realign/data/combined_manifest.csv filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
eol_realign/data/combined-manifest-licenses.csv filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
data/licenses.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -7,30 +7,61 @@ pretty_name: TreeOfLife10M EDA
|
|
| 7 |
|
| 8 |
This repo contains the analysis of the TreeOfLife10M dataset as it's being crafted and refined.
|
| 9 |
|
| 10 |
-
##
|
| 11 |
|
| 12 |
The `data` folder contains
|
| 13 |
-
- `catalog.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the associated taxa information for the image. This is the file that will be updated, while preserving the `catalog-v1-dev.csv` file for ease of comparison.
|
| 14 |
-
- `stats_avg_std_byClass.csv`: average and standard distribution of images given by class in `catalog.csv`. This is for both all
|
| 15 |
images, and images that have labels.
|
| 16 |
-
- `predicted-catalog.csv`: the metadata and identifiers for all entries expected in the dataset, prior to webdataset creation. This includes original data source, unique identifier within TreeOfLife10M, and the associated taxa information. In version 3.3 (first time it was generated), it showed 27K more entries than in the webdataset and they all had full taxonomic rank filled.
|
| 17 |
-
|
| 18 |
- `catalog-v1-dev.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the associated taxa information for the image. This file will be maintained for v1 reference, and as such will not be updated.
|
| 19 |
- `taxa_counts.csv`: count of distinct lower taxa within each higher taxon from `kingdom` down to
|
| 20 |
`genus` in `catalog-v1-dev.csv`, though the genus count was interrupted and therefore is incomplete.
|
| 21 |
- `avg_std_byClass.csv`: average and standard distribution of images in `catalog-v1-dev.csv` given by class (taxonomic rank). This is for both all images, and images that have labels. Note that kingdoms had not been merged and no standardization was performed on the taxonomic hierarchy prior to creation of this file.
|
| 22 |
- `tol_hierarchy_test.csv`: Subset of `catalog-v1-dev.csv` for testing the [`check_taxa` script](https://github.com/Imageomics/open_clip/blob/main/scripts/evobio10m/check_taxa.py) to ensure the hierarchy is properly filled in after data generation.
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
The `notebooks` folder contains
|
| 28 |
- `ToL_catalog_EDA.ipynb`: more full EDA of TreeOfLife10M dataset using `catalog.csv`. To be updated as `catalog.csv` is updated, i.e., as the dataset is updated.
|
| 29 |
- `ToL_catalog_EDA.py`: py file paired to `ToL_catalog_EDA.ipynb` to facilitate diff checking in case of cell text changes in notebook.
|
| 30 |
- `ToL_predicted-catalog_EDA.ipynb`: more full EDA of TreeOfLife10M dataset using `predicted-catalog.csv`. To be updated as `predicted-catalog.csv` is updated, i.e., as the dataset is updated.
|
| 31 |
- `ToL_predicted-catalog_EDA.py`: py file paired to `ToL_predicted-catalog_EDA.ipynb` to facilitate diff checking in case of cell text changes in notebook.
|
| 32 |
-
- `BioCLIP_taxa_viz.ipynb`: generates data visualizations, in particular, the generation of treemaps in `visuals` folder; also includes a histogram of kingdoms. The treemaps produced in the notebook are interactive and `HTML` interactive versions can also be found in [`visuals`](https://huggingface.co/datasets/imageomics/ToL-EDA/tree/main/visuals).
|
| 33 |
-
|
| 34 |
- `BioCLIP_data_viz.ipynb`: notebook with quick basic stats for `catalog-v1-dev.csv`, generates `taxa_counts.csv`.
|
| 35 |
- `BioCLIP_taxa_viz_bySource.ipynb`: generates data visualizations, in particular, the generation of visualizations in `visuals` folder and some histograms. The treemaps produced in the notebook are interactive.
|
| 36 |
- `ToL_EDA.ipynb`: more full EDA of TreeOfLife10M dataset. Explores the labeling inconsistencies for
|
|
@@ -39,7 +70,7 @@ direction of standardization efforts. Maintained for v1 reference, should not be
|
|
| 39 |
|
| 40 |
**Note:** run `pip install -r requirements.txt` before starting the visualization notebooks. EDA notebooks only require `pandas` and `seaborn`.
|
| 41 |
|
| 42 |
-
##
|
| 43 |
|
| 44 |
Visualizations generated to demonstrate the distribution and diversity within the phyla of TreeOfLife10M.
|
| 45 |
- `category-v1-visuals`: visualizations made for the original `catalog-v1-dev.csv` using `BioCLIP_taxa_viz_bySource.ipynb`.
|
|
|
|
| 7 |
|
| 8 |
This repo contains the analysis of the TreeOfLife10M dataset as it's being crafted and refined.
|
| 9 |
|
| 10 |
+
## Data
|
| 11 |
|
| 12 |
The `data` folder contains
|
| 13 |
+
- `catalog.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the associated taxa information for the image. This is the file that will be updated, while preserving the `catalog-v1-dev.csv` file for ease of comparison. [`v3.3`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/d6b583841aed8c0df314e718735756b76164a933/data/catalog.csv) is the version of the catalog that was used for training [BioCLIP v1](https://doi.org/10.57967/hf/1511) (it has the ~30K images we could not re-align).
|
| 14 |
+
- `stats_avg_std_byClass.csv`: average and standard distribution of images given by class in `catalog.csv`. This is for both all
|
| 15 |
images, and images that have labels.
|
| 16 |
+
- `predicted-catalog.csv`: the metadata and identifiers for all entries expected in the dataset, prior to webdataset creation. This includes original data source, unique identifier within TreeOfLife10M, and the associated taxa information. In version 3.3 (first time it was generated), it showed 27K more entries than in the webdataset and they all had full taxonomic rank filled.
|
|
|
|
| 17 |
- `catalog-v1-dev.csv`: the metadata and identifiers for all images in the dataset. This includes original data source, unique identifier within TreeOfLife10M, and the associated taxa information for the image. This file will be maintained for v1 reference, and as such will not be updated.
|
| 18 |
- `taxa_counts.csv`: count of distinct lower taxa within each higher taxon from `kingdom` down to
|
| 19 |
`genus` in `catalog-v1-dev.csv`, though the genus count was interrupted and therefore is incomplete.
|
| 20 |
- `avg_std_byClass.csv`: average and standard distribution of images in `catalog-v1-dev.csv` given by class (taxonomic rank). This is for both all images, and images that have labels. Note that kingdoms had not been merged and no standardization was performed on the taxonomic hierarchy prior to creation of this file.
|
| 21 |
- `tol_hierarchy_test.csv`: Subset of `catalog-v1-dev.csv` for testing the [`check_taxa` script](https://github.com/Imageomics/open_clip/blob/main/scripts/evobio10m/check_taxa.py) to ensure the hierarchy is properly filled in after data generation.
|
| 22 |
|
| 23 |
+
## Rare Species
|
| 24 |
+
All these files were generated in `eol_realign/notebooks/re-gen_rs_catalog.ipynb`.
|
| 25 |
+
- `licenses.csv`: Licensing information for all rarespecies images (includes MD5s and links to catalog and manifest on `rarespecies_id`).
|
| 26 |
+
- `rarespecies_manifest.csv`: Full manifest information for all images included in rarespecies catalog (may have some extra info from realign).
|
| 27 |
+
- `rarespecies-catalog.csv`: Catalog of all images included in [Rare Species dataset](https://huggingface.co/imageomics/rare-species).
|
| 28 |
+
For evaluation, Lisa generated a `metadata.csv` that cut the `rarespecies-catalog.csv` down to just the taxonomic columns with index, changing `class` to `cls`, `common` to `common_name`, and creating a `filepath` column (`"2024-03-20/" + <eol_content_id> + "_" + <eol_page_id> + "_eol-full-size-copy.jpg"`), with a `class` column indicating the `sciName` (though this could use a different ID depending on the evaluation).
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
## EOL Re-align
|
| 32 |
+
|
| 33 |
+
More detail on the background of this process can be found in the `links_align_reduced` and `links_rs_duplicates` notebooks, as well as [PR #5](https://huggingface.co/datasets/imageomics/ToL-EDA/discussions/5).
|
| 34 |
+
|
| 35 |
+
* **Data:**
|
| 36 |
+
More information on all the datacan be found in the `links_align_reduced` and `links_rs_duplicates` notebooks. Just those of primary import and potential continued use are listed here.
|
| 37 |
|
| 38 |
+
- `checksums_media_cargo_archive.csv`: MD5 of all EOL images in our cargo archive.
|
| 39 |
+
- `full_owner_manifset.csv`: Record of all images from EOL that could potentially be used in the TreeOfLife-10M dataset, this has all the non-taxonomic EOL metadata for the EOL images included in the TreeOfLife-10M catalog (12,330,062 entries, gets reduced down during catalog re-generation), with MD5s aligned to `filename` (`<eol_content_id>_<eol_page_id>_eol-full-size-copy.jpg`).
|
| 40 |
+
- `rarespecies_full_manifest.csv`: Record of all images from EOL that could potentially be used in the Rare Species dataset, i.e., manifest of all images from EOL of the 400 selected species, with MD5s aligned to `filename` (`<eol_content_id>_<eol_page_id>_eol-full-size-copy.jpg`).
|
| 41 |
+
|
| 42 |
+
* **Notebooks:** (Require `pandas`).
|
| 43 |
+
|
| 44 |
+
- `catalog-cargo-manifest_test.ipynb`: Generates `eol_realign/data/full_owner_manifest.csv`, this has all the non-taxonomic EOL metadata for the EOL images included in the TreeOfLife-10M catalog (12,330,062 entries, gets reduced down during catalog re-generation).
|
| 45 |
+
- `links_align_reduced.ipynb`: Exploration of the degree to which we could realign the EOL files in our TreeOfLife-10M catalog to their associated metadata. There was some recovery from our original loss. Associated `py` file: `links_align_reduced.py`.
|
| 46 |
+
- `links_rs_duplicates.ipynb`: Documentation of mismatches in the Rare Species dataset and suggestion for fixing them. Saves these in `eol_realign/data/archive_mismatched_rarespecies.csv`, and generates `eol_realign/data/rarespecies_full_manifest.csv`. Uses `eol_realign/data/eol-cargo-archive_combined-manifest-checksums_links.csv`, [`rarespecies-catalog-orig.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/rare_species/data/rarespecies-catalog.csv), `eol_realign/data/rarespecies_missing_pages_md5s.csv`, `eol_realign/data/eol_media_manifest_2024-03-11.csv`, and [`media_manifest_missing_licenses_jul26_owners.csv`](https://huggingface.co/datasets/imageomics/eol/blob/main/owners_info_fix/media_manifest_missing_licenses_jul26_owners.csv). Associated `py` file: `links_rs_duplicates.py`.
|
| 47 |
+
- `re-gen_rs_catalog.ipynb`: Notebook generating the updated rare species catalog, lisences, and manifest files. Generates new `rarespecies_id`; these are still distinct from `treeoflife_id`s in TreeOfLife-10M. Uses `eol_realign/data/rarespecies_full_manifest.csv`and [`rarespecies-catalog-orig.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/rare_species/data/rarespecies-catalog.csv).
|
| 48 |
+
Outputs: `rare_species/data/rarespecies_manifest.csv`, `rare_species/data/licenses.csv`, and `rare_species/data/rarespecies-catalog.csv`.
|
| 49 |
+
- `re-gen_tol_catalog.ipynb`: Notebook updating catalog for TreeOfLife-10M (all EOL entries we could realign), along with the corresponding license file, and manifest with full information for the realigned entries. Uses `eol_realign/data/combined-manifest-licenses.csv`, [`catalog-orig-v3-3.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/d6b583841aed8c0df314e718735756b76164a933/data/catalog.csv).
|
| 50 |
+
Outputs: `eol_realign/data/full_owner_manifest.csv`, `data/licenses.csv`, and `data/catalog.csv`.
|
| 51 |
+
|
| 52 |
+
* **Scripts:** (Require `pandas`).
|
| 53 |
+
|
| 54 |
+
- `make_licenses.py`: Adds license URLs to make the full manifest and license file.
|
| 55 |
+
- `match_owners.py`: Adds extra licensing information toward making the full manifest. Uses `eol_realign/data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv`, makes `eol_realign/data/combined_manifest.csv` for generating final catalog.
|
| 56 |
+
|
| 57 |
+
## Notebooks
|
| 58 |
|
| 59 |
The `notebooks` folder contains
|
| 60 |
- `ToL_catalog_EDA.ipynb`: more full EDA of TreeOfLife10M dataset using `catalog.csv`. To be updated as `catalog.csv` is updated, i.e., as the dataset is updated.
|
| 61 |
- `ToL_catalog_EDA.py`: py file paired to `ToL_catalog_EDA.ipynb` to facilitate diff checking in case of cell text changes in notebook.
|
| 62 |
- `ToL_predicted-catalog_EDA.ipynb`: more full EDA of TreeOfLife10M dataset using `predicted-catalog.csv`. To be updated as `predicted-catalog.csv` is updated, i.e., as the dataset is updated.
|
| 63 |
- `ToL_predicted-catalog_EDA.py`: py file paired to `ToL_predicted-catalog_EDA.ipynb` to facilitate diff checking in case of cell text changes in notebook.
|
| 64 |
+
- `BioCLIP_taxa_viz.ipynb`: generates data visualizations, in particular, the generation of treemaps in `visuals` folder; also includes a histogram of kingdoms. The treemaps produced in the notebook are interactive and `HTML` interactive versions can also be found in [`visuals`](https://huggingface.co/datasets/imageomics/ToL-EDA/tree/main/visuals).
|
|
|
|
| 65 |
- `BioCLIP_data_viz.ipynb`: notebook with quick basic stats for `catalog-v1-dev.csv`, generates `taxa_counts.csv`.
|
| 66 |
- `BioCLIP_taxa_viz_bySource.ipynb`: generates data visualizations, in particular, the generation of visualizations in `visuals` folder and some histograms. The treemaps produced in the notebook are interactive.
|
| 67 |
- `ToL_EDA.ipynb`: more full EDA of TreeOfLife10M dataset. Explores the labeling inconsistencies for
|
|
|
|
| 70 |
|
| 71 |
**Note:** run `pip install -r requirements.txt` before starting the visualization notebooks. EDA notebooks only require `pandas` and `seaborn`.
|
| 72 |
|
| 73 |
+
## Visuals
|
| 74 |
|
| 75 |
Visualizations generated to demonstrate the distribution and diversity within the phyla of TreeOfLife10M.
|
| 76 |
- `category-v1-visuals`: visualizations made for the original `catalog-v1-dev.csv` using `BioCLIP_taxa_viz_bySource.ipynb`.
|
data/catalog.csv
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:215d0080ebf9016e0f471aa037b4201b5a611c2675c85dfec02a23dae03bbaee
|
| 3 |
+
size 2043627688
|
data/licenses.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0486ac72f6c2654913bf81b187b34c466a6e13ef8db036b583c286bb9845e2f4
|
| 3 |
+
size 2216478840
|
eol_realign/data/checksums_media_cargo_archive.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5b30008ba49fd342881e7ecd47c248d2a1c9b39960913518fcb78896bef3805
|
| 3 |
+
size 490626452
|
eol_realign/data/combined-manifest-licenses.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ccd5290be9d8d2ab0953774d804d8b436ceef791aca57647a523be5c92cc9c0
|
| 3 |
+
size 4380387723
|
eol_realign/data/combined_manifest.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1bf620f9b11854d2551f06f5f01e33c6817d7c74187ed4423af1ae9a415e2ef5
|
| 3 |
+
size 4057029393
|
eol_realign/data/combined_manifest_with_checksums.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:03c75970541ad805c8f308dbe19d5b71642b724ced6324b240db41cd3e37b045
|
| 3 |
+
size 4655278768
|
eol_realign/data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fc0cc8d4555ed4cf3e5bba2f0c88339bc605ca30982e427d7288e1eb0e74071e
|
| 3 |
+
size 3921517771
|
eol_realign/data/eol-cargo-archive_combined-manifest-checksums_links.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c53ba3c261089abe0ce8fc7e21fc21baa111db3e06333aaedc090f66c5a9519
|
| 3 |
+
size 3545231521
|
eol_realign/data/full_owner_manifest.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0961941b5fcae87f2a4dfacb7d7c29c64d5ef95679c62d16a46fa54d6c0a0f77
|
| 3 |
+
size 3208683463
|
eol_realign/data/links_cargo_manifest_IDmismatch.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d62a33290d4a96f34c4970104530ea9f97f343babe8e4a766402236c753bdf66
|
| 3 |
+
size 330698785
|
eol_realign/data/links_inner.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9cd1db106c3cc456aac9605623eaa728fc70ce48b31d91f3f2242e3a15b6b676
|
| 3 |
+
size 3721927423
|
eol_realign/data/links_manifest_cargo_on_md5.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9d5eea48c971a3c2c2cfeb8afa1708f19806bad5d44938b20e1dc379a37c24f
|
| 3 |
+
size 2824039443
|
eol_realign/data/mismatched_rarespecies.csv
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
rarespecies_id,eol_content_id_rs,eol_page_id_rs,kingdom,phylum,class,order,family,genus,species,sciName,combined_id_rs
|
| 2 |
+
9f8a41bb-8660-452a-a6b4-77c62b50549d,9474947,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474947_46559139
|
| 3 |
+
ba2857c7-f02d-44f9-a116-8a450dc53e14,30098516,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098516_205909
|
| 4 |
+
865985be-bc20-406b-afc9-042029f0538d,29734616,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734616_1011315
|
| 5 |
+
78c2767b-b0d8-4f91-a176-017ca0053237,29707495,46559297,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Tursiops,aduncus,Tursiops aduncus,29707495_46559297
|
| 6 |
+
66d569b3-da18-4a26-89c0-9400a1de61ca,9485028,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485028_46559307
|
| 7 |
+
ea6afe07-67ac-498a-b80b-2e2aca041c26,27592105,46560177,Animalia,Chordata,Chondrichthyes,Squaliformes,Dalatiidae,Dalatias,licha,Dalatias licha,27592105_46560177
|
| 8 |
+
3fe63299-e900-4d4f-b79d-d4261c66aeec,29859204,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859204_208913
|
| 9 |
+
ea60af4a-c726-40e0-9c50-1ff1b130d53a,9474904,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474904_46559139
|
| 10 |
+
f8620fb6-a9ad-4b66-985d-77129744cd84,9485033,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485033_46559307
|
| 11 |
+
95642535-20e8-472d-ba52-dadb9fd4a7a5,29859220,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859220_208913
|
| 12 |
+
0a61e001-b413-496f-a52c-ff861b97ed9b,29734622,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734622_1011315
|
| 13 |
+
c10a1491-a937-4355-b80c-e0ad00c6772b,29859198,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859198_208913
|
| 14 |
+
be2d753c-4079-4409-9f49-4e49fb605003,27592101,46560177,Animalia,Chordata,Chondrichthyes,Squaliformes,Dalatiidae,Dalatias,licha,Dalatias licha,27592101_46560177
|
| 15 |
+
83dd55d9-0599-4527-a546-806a31877c98,30098519,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098519_205909
|
| 16 |
+
89371754-476c-449d-8ae7-f2c5c70a68ee,9484693,46559297,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Tursiops,aduncus,Tursiops aduncus,9484693_46559297
|
| 17 |
+
e59c07d0-e70b-436b-ad80-4f8cf44d1b42,29620709,794282,Animalia,Chordata,Reptilia,Testudines,Testudinidae,Centrochelys,sulcata,Centrochelys sulcata,29620709_794282
|
| 18 |
+
0e4e8f48-a0de-493b-93d2-f2353358ca5b,9485042,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485042_46559307
|
| 19 |
+
8bbc0ddf-e234-4de1-a188-e47c71b21982,9485046,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485046_46559307
|
| 20 |
+
fa50fced-f9fe-49b1-aee0-fef9dd10e6ae,9445585,1019162,Animalia,Chordata,Amphibia,Anura,Dendrobatidae,Phyllobates,vittatus,Phyllobates vittatus,9445585_1019162
|
| 21 |
+
8838c823-d1e4-4523-bd8f-2aa8cdb764cc,27941416,46561008,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Myliobatidae,Myliobatis,aquila,Myliobatis aquila,27941416_46561008
|
| 22 |
+
d436ec20-202d-44ec-9081-ca59afef356f,27648166,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648166_46560546
|
| 23 |
+
d239159f-cb15-4c30-8aeb-d8177f8cf34a,30098492,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098492_205909
|
| 24 |
+
d5c2a6bd-7278-4163-8361-7b24af2670e5,29859207,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859207_208913
|
| 25 |
+
8fbd2e19-e365-4526-8bb8-dcdd75f0bd6b,9474887,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474887_46559139
|
| 26 |
+
75ba5701-7e0d-4003-a32d-8c7bffccdd72,9443811,118008,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,brasiliensis,Sylvilagus brasiliensis,9443811_118008
|
| 27 |
+
51fc27c8-892d-4884-90ab-5b04c16efde3,9444372,45511531,Animalia,Chordata,Aves,Accipitriformes,Accipitridae,Harpia,harpyja,Harpia harpyja,9444372_45511531
|
| 28 |
+
b74d1ed5-39cb-4b99-9dc1-987cea96d0d4,30102018,331381,Animalia,Chordata,Amphibia,Caudata,Plethodontidae,Desmognathus,imitator,Desmognathus imitator,30102018_331381
|
| 29 |
+
4856f506-1446-4a00-be45-6f1dd0fb6305,9474917,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474917_46559139
|
| 30 |
+
1935e9cd-a291-4b8a-ac49-0381e590ec14,27592100,46560177,Animalia,Chordata,Chondrichthyes,Squaliformes,Dalatiidae,Dalatias,licha,Dalatias licha,27592100_46560177
|
| 31 |
+
e899bede-284b-4332-b63f-59f195d789ee,9474899,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474899_46559139
|
| 32 |
+
c22cc2bd-fe54-4a24-a611-b68ef771baf0,29734641,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734641_1011315
|
| 33 |
+
6cb50905-48ee-4770-9605-91a95e3d027c,27648159,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648159_46560546
|
| 34 |
+
83bdf16f-aec8-4d0f-99bc-b8706612d52c,29734617,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734617_1011315
|
| 35 |
+
a3658a31-667e-4899-ad95-1aaa86843cc3,9484692,46559297,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Tursiops,aduncus,Tursiops aduncus,9484692_46559297
|
| 36 |
+
c7b23b7e-ae67-4e53-85ad-c7eaf14dfdd9,9485035,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485035_46559307
|
| 37 |
+
de4a6ca0-6fc2-40de-907e-c99b98a9ca3e,27648164,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648164_46560546
|
| 38 |
+
4b9e099c-da80-490d-8557-50bce4b78eb0,29859197,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859197_208913
|
| 39 |
+
cf5c65b1-fff0-46fc-9aa9-c6851f074b1d,14044906,46559748,Animalia,Chordata,Chondrichthyes,Lamniformes,Cetorhinidae,Cetorhinus,maximus,Cetorhinus maximus,14044906_46559748
|
| 40 |
+
f16f275e-d112-400b-a166-a2b7235bdf00,27640830,46559744,Animalia,Chordata,Chondrichthyes,Lamniformes,Alopiidae,Alopias,vulpinus,Alopias vulpinus,27640830_46559744
|
| 41 |
+
3d60ffa3-3622-4716-bbba-4862cb44e1cf,9485040,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485040_46559307
|
| 42 |
+
30982c26-de59-48dc-81f6-e2a6cdd981fa,9474916,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474916_46559139
|
| 43 |
+
fc76a950-5cd6-4d7f-aacd-adbf9bce2856,29734635,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734635_1011315
|
| 44 |
+
8d780e6e-5565-4930-b772-41c0746c6c7d,29980060,46559786,Animalia,Chordata,Chondrichthyes,Carcharhiniformes,Carcharhinidae,Carcharhinus,melanopterus,Carcharhinus melanopterus,29980060_46559786
|
| 45 |
+
a7ed9423-c335-4f7b-aea7-654f0ad4c380,30098503,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098503_205909
|
| 46 |
+
16262d9d-b99d-47ce-9eba-5282cbda539e,29734624,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734624_1011315
|
| 47 |
+
2bcba9f3-a3a4-4a2b-a4f4-84e35be0e35f,27648163,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648163_46560546
|
| 48 |
+
d4206d7e-5f1c-4b7d-9e5f-77533e76397e,27592104,46560177,Animalia,Chordata,Chondrichthyes,Squaliformes,Dalatiidae,Dalatias,licha,Dalatias licha,27592104_46560177
|
| 49 |
+
682f09af-fd52-48c3-a1c9-517d3ac19e11,9484694,46559297,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Tursiops,aduncus,Tursiops aduncus,9484694_46559297
|
| 50 |
+
2ccd58d0-e23b-4d5a-9801-ae01d810657e,27734034,46560555,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,undulata,Raja undulata,27734034_46560555
|
| 51 |
+
d618c15c-aabc-444a-8c44-09ce76377fd8,9485038,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485038_46559307
|
| 52 |
+
ed766585-5418-4147-8543-a31304f591ca,30098514,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098514_205909
|
| 53 |
+
12633820-3a3a-4c77-bd38-7221bd18b747,27648157,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648157_46560546
|
| 54 |
+
92d425c4-0667-4df4-9977-31c16ade233e,30070655,45511267,Animalia,Chordata,Aves,Procellariiformes,Diomedeidae,Phoebastria,albatrus,Phoebastria albatrus,30070655_45511267
|
| 55 |
+
41c425c2-0db1-45b9-a27d-855dc9426d2a,9474945,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474945_46559139
|
| 56 |
+
3bb2a37c-d33d-4f8b-a1ae-ae70fad3ec47,9444423,45511624,Animalia,Chordata,Aves,Trogoniformes,Trogonidae,Trogon,bairdii,Trogon bairdii,9444423_45511624
|
| 57 |
+
4a733627-6adb-4700-9b85-d3d352b5d2f3,29859199,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859199_208913
|
| 58 |
+
266fed3d-0002-43da-93e6-39a3897d93e6,9474924,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474924_46559139
|
| 59 |
+
f422aa72-40b3-4f0a-82fa-6cf519aea5c9,29972857,1056842,Animalia,Chordata,Reptilia,Testudines,Emydidae,Glyptemys,muhlenbergii,Glyptemys muhlenbergii,29972857_1056842
|
| 60 |
+
26b11b35-9752-4ce9-8dbb-98e12bcd0b0d,29859202,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859202_208913
|
| 61 |
+
b30b1b0f-7dd7-46ca-833a-313b2dc6efde,9474953,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474953_46559139
|
| 62 |
+
8a7eae46-57af-4132-b914-78556479db67,27648161,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648161_46560546
|
| 63 |
+
f6b1a72f-6e1f-47fc-b303-918da4e2232b,27941417,46561008,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Myliobatidae,Myliobatis,aquila,Myliobatis aquila,27941417_46561008
|
| 64 |
+
9b80b959-e80f-4356-b16e-0540612fbbc3,27592102,46560177,Animalia,Chordata,Chondrichthyes,Squaliformes,Dalatiidae,Dalatias,licha,Dalatias licha,27592102_46560177
|
| 65 |
+
98cb12e1-2f03-4866-a452-1c0b98049bd2,30098524,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098524_205909
|
| 66 |
+
8f593774-d837-452f-80d7-5865bb148e6d,29859193,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859193_208913
|
| 67 |
+
b4f2cd0b-4d59-4e08-a04f-9021bb06442f,27559496,52572074,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Dasyatidae,Bathytoshia,centroura,Bathytoshia centroura,27559496_52572074
|
| 68 |
+
d23ece02-4cce-4c25-88b9-c3926039b3c2,29510035,130548,Animalia,Arthropoda,Insecta,Lepidoptera,Papilionidae,Luehdorfia,japonica,Luehdorfia japonica,29510035_130548
|
| 69 |
+
c41ed523-e9ed-405f-9335-aa828ea60be6,9484689,46559297,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Tursiops,aduncus,Tursiops aduncus,9484689_46559297
|
| 70 |
+
431abd61-10a8-481b-85fd-8d4624da9611,30098512,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098512_205909
|
| 71 |
+
3b00b8ea-bca8-4b10-b66f-010f7d853ebc,27559495,52572074,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Dasyatidae,Bathytoshia,centroura,Bathytoshia centroura,27559495_52572074
|
| 72 |
+
6916deca-f92a-4200-bd79-0b201cef23f9,29859210,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859210_208913
|
| 73 |
+
5c5188e3-0061-4982-a36d-80108e1700c3,30098482,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098482_205909
|
| 74 |
+
88e8ca3d-07f2-40f3-9580-75088f1c3680,29734631,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734631_1011315
|
| 75 |
+
9346e1e6-aa08-4f9b-aeb6-5a3703f41cac,9474918,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474918_46559139
|
| 76 |
+
b0f9408a-79e8-4b22-8e84-955f3756e13c,27586446,46560594,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Rostroraja,alba,Rostroraja alba,27586446_46560594
|
| 77 |
+
598cadc6-9dec-4dd7-8599-158287ecf2f2,9485045,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485045_46559307
|
| 78 |
+
0587179f-cae6-40b0-8042-018680b6b024,29734629,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734629_1011315
|
| 79 |
+
31d02182-7226-4d3e-bbaa-b0d7fef674cf,30098507,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098507_205909
|
| 80 |
+
d57c662e-52db-42da-97e1-7547e2307282,27648158,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648158_46560546
|
| 81 |
+
88835f27-da8a-49cc-8b53-60de1e8dd3a6,29859191,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859191_208913
|
| 82 |
+
d50ab51c-6771-462d-94fe-5de142240b87,29859221,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859221_208913
|
| 83 |
+
536f3c1d-e0a4-4a0f-ba63-4970763ae762,29859215,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859215_208913
|
| 84 |
+
0f1ba847-060e-4349-b557-3fca25387b94,30098501,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098501_205909
|
| 85 |
+
592e1992-7891-49b0-a484-ca3e075b5178,29270483,46559793,Animalia,Chordata,Chondrichthyes,Carcharhiniformes,Carcharhinidae,Carcharhinus,amblyrhynchos,Carcharhinus amblyrhynchos,29270483_46559793
|
| 86 |
+
9806169f-b895-4943-9d9e-7d21ada7b9d3,9474972,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474972_46559139
|
| 87 |
+
5765f247-60bc-4d22-bac2-903d7da45793,9485047,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485047_46559307
|
| 88 |
+
913a4ab5-2dbe-4c98-8552-fc9b9c155774,9466096,1010637,Animalia,Chordata,Mammalia,Primates,Cercopithecidae,Cercopithecus,mona,Cercopithecus mona,9466096_1010637
|
| 89 |
+
e1048070-ade5-4c62-bc6a-d1aa7958dcec,9474902,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474902_46559139
|
| 90 |
+
09f03a21-01b3-41c4-9d79-1acf20449b07,9474876,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474876_46559139
|
| 91 |
+
ff230c11-7fe7-4d9f-be34-8545dc1c8d22,9485036,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485036_46559307
|
| 92 |
+
3d8684c9-94c2-4100-8ee7-f3495bb5fb6c,9474898,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474898_46559139
|
| 93 |
+
5710e528-e246-4b5e-b8dc-2bd2d34fff2d,9467381,4453917,Animalia,Chordata,Mammalia,Primates,Cercopithecidae,Piliocolobus,tephrosceles,Piliocolobus tephrosceles,9467381_4453917
|
| 94 |
+
f23ead6e-807f-47db-9ae6-5cfd2244cc17,28043084,46560148,Animalia,Chordata,Chondrichthyes,Hexanchiformes,Hexanchidae,Hexanchus,griseus,Hexanchus griseus,28043084_46560148
|
| 95 |
+
fee8030c-e05b-4acd-b728-3ef6a73e410a,9474910,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474910_46559139
|
| 96 |
+
0c1f17f2-f02a-44f4-8f74-a874e5c8cdc8,29859196,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859196_208913
|
| 97 |
+
90a6003e-9e0f-4c1e-96c9-320633425173,29859203,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859203_208913
|
| 98 |
+
dda8a68a-ad8f-4c4a-8bf7-96b083fb3945,29859223,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859223_208913
|
| 99 |
+
bd27fc74-caa5-4fe3-9dbc-776127bd03e7,30098489,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098489_205909
|
| 100 |
+
a7c43306-6a3a-4d94-b7f0-147ad9f20a73,27648160,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648160_46560546
|
| 101 |
+
06f59f63-99e7-4b44-a868-d478cb6409f2,29859205,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859205_208913
|
| 102 |
+
44087ce6-531e-42cc-a64b-450f42f6bead,29734621,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734621_1011315
|
| 103 |
+
d33f93de-31ec-434a-985e-a9cdeb79b557,30098484,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098484_205909
|
| 104 |
+
6e3ea9d1-24dc-4c31-a893-ee66e1e7dad1,28043087,46560148,Animalia,Chordata,Chondrichthyes,Hexanchiformes,Hexanchidae,Hexanchus,griseus,Hexanchus griseus,28043087_46560148
|
| 105 |
+
acc6b0a9-7b58-4696-a4ff-4116f702fb9b,27640829,46559744,Animalia,Chordata,Chondrichthyes,Lamniformes,Alopiidae,Alopias,vulpinus,Alopias vulpinus,27640829_46559744
|
| 106 |
+
d6956958-da73-457e-97f2-86101109ef8e,28043085,46560148,Animalia,Chordata,Chondrichthyes,Hexanchiformes,Hexanchidae,Hexanchus,griseus,Hexanchus griseus,28043085_46560148
|
| 107 |
+
aba17319-737e-4b71-9cc0-587dbb1ac8d8,29734639,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734639_1011315
|
| 108 |
+
e9648a9a-db26-42dd-9bbf-bcd194d15235,29859214,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859214_208913
|
| 109 |
+
5a51fdd0-99c5-4f4d-9fda-303f523c4896,9474883,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474883_46559139
|
| 110 |
+
b34a8904-570d-46b9-99b1-0ad29dc94853,9474949,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474949_46559139
|
| 111 |
+
45a14e5c-9d2e-402a-9289-2f23a9e51922,9485026,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485026_46559307
|
| 112 |
+
cf8f3c23-eb83-40a5-979c-e9359b2b9df9,27640828,46559744,Animalia,Chordata,Chondrichthyes,Lamniformes,Alopiidae,Alopias,vulpinus,Alopias vulpinus,27640828_46559744
|
| 113 |
+
dc918a92-ebe9-4a1e-b409-9e439b30115a,9485048,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485048_46559307
|
| 114 |
+
1bbc4d67-196b-42e9-9adb-732b1a00ac58,29859208,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859208_208913
|
| 115 |
+
4d7436d1-82de-416b-8a51-6452efd45f44,30098515,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098515_205909
|
| 116 |
+
ef260410-a53c-4c31-b5e6-963bf056420c,29859186,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859186_208913
|
| 117 |
+
667586ab-145a-4076-9669-535447aa2b6c,30098504,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098504_205909
|
| 118 |
+
c7174eb2-e49f-4db3-a2d7-9bb050fd2646,27586444,46560594,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Rostroraja,alba,Rostroraja alba,27586444_46560594
|
| 119 |
+
c3dd1f33-9099-444f-9f8f-edf5f5d0991d,29859227,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859227_208913
|
| 120 |
+
2d342a7c-7e0c-4981-9630-019bb90183be,30098499,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098499_205909
|
| 121 |
+
d8fca198-63e2-4b93-8905-87a1c2713aaa,9485037,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485037_46559307
|
| 122 |
+
7cc1773c-3595-4bc7-8817-d33299036a53,29734638,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734638_1011315
|
| 123 |
+
754bf208-0891-46db-807d-bdc5290169c8,27640831,46559744,Animalia,Chordata,Chondrichthyes,Lamniformes,Alopiidae,Alopias,vulpinus,Alopias vulpinus,27640831_46559744
|
| 124 |
+
46328a46-c77c-407b-b5a3-49e457ce8e27,9485027,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485027_46559307
|
| 125 |
+
3b2af1eb-0672-48b2-91b9-35d982bd592e,28043079,46560148,Animalia,Chordata,Chondrichthyes,Hexanchiformes,Hexanchidae,Hexanchus,griseus,Hexanchus griseus,28043079_46560148
|
| 126 |
+
17668f81-e13e-467a-8343-c8a8400d56bf,28043082,46560148,Animalia,Chordata,Chondrichthyes,Hexanchiformes,Hexanchidae,Hexanchus,griseus,Hexanchus griseus,28043082_46560148
|
| 127 |
+
2a7befd0-9abc-40fc-a4dd-473f724a477b,27592103,46560177,Animalia,Chordata,Chondrichthyes,Squaliformes,Dalatiidae,Dalatias,licha,Dalatias licha,27592103_46560177
|
| 128 |
+
98f5aea6-b0d8-4b66-8dda-042d3140b203,27559497,52572074,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Dasyatidae,Bathytoshia,centroura,Bathytoshia centroura,27559497_52572074
|
| 129 |
+
9a96a903-61e5-41a3-9dc2-8f0bd906f82f,9474934,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474934_46559139
|
| 130 |
+
a33feafd-0954-4d71-a7e5-331a28abe1ec,9443813,118008,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,brasiliensis,Sylvilagus brasiliensis,9443813_118008
|
| 131 |
+
ef9fdea8-45e3-4037-8b8a-aa30381bd9f8,9466102,1010637,Animalia,Chordata,Mammalia,Primates,Cercopithecidae,Cercopithecus,mona,Cercopithecus mona,9466102_1010637
|
| 132 |
+
3c5c82b0-1a3a-4c0b-ade7-a8bf32fdac10,9474932,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474932_46559139
|
| 133 |
+
88b4f4e8-f5f9-4977-8f2b-8be6f5c62da5,29859200,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859200_208913
|
| 134 |
+
5c7fc0d0-52ab-4e8a-aada-583702c22d1b,29734620,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734620_1011315
|
| 135 |
+
8f53eebf-d878-49df-8bda-89f31bb0c8f1,27559498,52572074,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Dasyatidae,Bathytoshia,centroura,Bathytoshia centroura,27559498_52572074
|
| 136 |
+
9bccfc8e-714a-476f-ba72-c063d9369fe2,29859219,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859219_208913
|
| 137 |
+
2046eca8-c21b-4f9b-a36c-6827bd598e0e,9465816,324405,Animalia,Chordata,Mammalia,Primates,Cheirogaleidae,Microcebus,rufus,Microcebus rufus,9465816_324405
|
| 138 |
+
5d93a2dc-2341-4ecd-a357-71a996e46af1,9485039,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485039_46559307
|
| 139 |
+
77f98914-c53e-4506-b076-7a1e13abf4ed,9474952,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474952_46559139
|
| 140 |
+
88ec953f-2adf-4cb2-b984-abb1949c3165,9474895,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474895_46559139
|
| 141 |
+
f25b5a17-6bc1-47cb-91f6-b3ed1edd3f31,29859222,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859222_208913
|
| 142 |
+
ccda992d-6452-412f-a626-7af8f36bcea2,27941420,46561008,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Myliobatidae,Myliobatis,aquila,Myliobatis aquila,27941420_46561008
|
| 143 |
+
24c7c44b-cdb5-4eeb-808a-9f55d6dadf8c,9485043,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485043_46559307
|
| 144 |
+
2de51d63-b717-4695-8d2c-ba2fdb6d5315,9444371,45511531,Animalia,Chordata,Aves,Accipitriformes,Accipitridae,Harpia,harpyja,Harpia harpyja,9444371_45511531
|
| 145 |
+
92da8fa4-fb94-42b3-9483-86d2672d6644,27648165,46560546,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Raja,asterias,Raja asterias,27648165_46560546
|
| 146 |
+
db166886-1dad-43b1-aae6-7f2ef13e467a,27586445,46560594,Animalia,Chordata,Chondrichthyes,Rajiformes,Rajidae,Rostroraja,alba,Rostroraja alba,27586445_46560594
|
| 147 |
+
1ebedee8-eacd-44db-a97c-b9ec7e5c70a2,9474925,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474925_46559139
|
| 148 |
+
44ab910b-1d77-4161-b646-de56b366be3e,9484696,46559297,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Tursiops,aduncus,Tursiops aduncus,9484696_46559297
|
| 149 |
+
e202b109-b3bf-41ea-acf5-050ed671884c,9474957,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474957_46559139
|
| 150 |
+
30e91837-7b30-4aaa-9071-602c12f7d64f,29859190,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859190_208913
|
| 151 |
+
97a64450-ec40-4d53-8b0f-20c32290e9a3,9474944,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474944_46559139
|
| 152 |
+
94598086-9752-4f5f-84e8-31b1480de2c1,9474908,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474908_46559139
|
| 153 |
+
069eec43-535e-48de-a93d-711a64221800,29859218,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859218_208913
|
| 154 |
+
a25bc949-92b6-4cb7-b583-06aea68fdd85,29734627,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734627_1011315
|
| 155 |
+
3960c9c5-5ff3-4990-bb88-52d695dedc65,29859206,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859206_208913
|
| 156 |
+
9630b0fa-0d44-4238-bfad-52bca531b552,28940905,46571820,Animalia,Chordata,Actinopterygii,Labriformes,Labridae,Lachnolaimus,maximus,Lachnolaimus maximus,28940905_46571820
|
| 157 |
+
a9560f41-403d-46a0-a92a-9694cceffe96,30098523,205909,Animalia,Chordata,Actinopterygii,Acipenseriformes,Acipenseridae,Scaphirhynchus,albus,Scaphirhynchus albus,30098523_205909
|
| 158 |
+
f6d75624-6581-4bc4-826f-4c7bc30bde4b,29445364,1050315,Animalia,Chordata,Aves,Passeriformes,Thraupidae,Certhidea,olivacea,Certhidea olivacea,29445364_1050315
|
| 159 |
+
a4ae6563-4aa1-41f7-ab5a-b042d23eee9b,27640833,46559744,Animalia,Chordata,Chondrichthyes,Lamniformes,Alopiidae,Alopias,vulpinus,Alopias vulpinus,27640833_46559744
|
| 160 |
+
8bcc9b8a-de04-42dc-83e6-e79b433f5ab5,9443812,118008,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,brasiliensis,Sylvilagus brasiliensis,9443812_118008
|
| 161 |
+
22906c73-8288-4eb0-bb06-8b6bfae40b13,9485041,46559307,Animalia,Chordata,Mammalia,Cetacea,Delphinidae,Sousa,plumbea,Sousa plumbea,9485041_46559307
|
| 162 |
+
557dc6bf-d462-4ff7-9cbd-50197114af5f,27941422,46561008,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Myliobatidae,Myliobatis,aquila,Myliobatis aquila,27941422_46561008
|
| 163 |
+
915e1291-ecaa-4e09-a3be-8e171b841278,29859226,208913,Animalia,Chordata,Actinopterygii,Cyprinodontiformes,Goodeidae,Zoogoneticus,tequila,Zoogoneticus tequila,29859226_208913
|
| 164 |
+
83a4f5ac-5d48-45bc-ba94-0f63d3238177,29734628,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734628_1011315
|
| 165 |
+
59ae92b5-a679-482c-9ff7-ea8d189e8ba2,9474974,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474974_46559139
|
| 166 |
+
a40ccf8f-a0ea-4590-8815-35a1b0bb5e86,30025401,333429,Animalia,Chordata,Amphibia,Anura,Mantellidae,Mantella,aurantiaca,Mantella aurantiaca,30025401_333429
|
| 167 |
+
e67db980-b824-445d-9fcd-ff5b645e6524,9465815,324405,Animalia,Chordata,Mammalia,Primates,Cheirogaleidae,Microcebus,rufus,Microcebus rufus,9465815_324405
|
| 168 |
+
44bc35e0-f37c-490b-a78f-acf403dc6a7c,29972861,1056842,Animalia,Chordata,Reptilia,Testudines,Emydidae,Glyptemys,muhlenbergii,Glyptemys muhlenbergii,29972861_1056842
|
| 169 |
+
845eef8e-5108-4793-8113-0fdf4ef0f7ce,22564200,795274,Animalia,Chordata,Reptilia,Crocodilia,Crocodylidae,Crocodylus,rhombifer,Crocodylus rhombifer,22564200_795274
|
| 170 |
+
aac57174-8b33-4f98-a9ba-3c467e4297ad,22564199,795274,Animalia,Chordata,Reptilia,Crocodilia,Crocodylidae,Crocodylus,rhombifer,Crocodylus rhombifer,22564199_795274
|
| 171 |
+
dc2ba6ca-df57-4a26-9041-422939415a86,29734626,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734626_1011315
|
| 172 |
+
f3f30b6c-b9ec-4714-857e-e89631a5b9ca,29734618,1011315,Animalia,Chordata,Mammalia,Lagomorpha,Leporidae,Sylvilagus,transitionalis,Sylvilagus transitionalis,29734618_1011315
|
| 173 |
+
b5872a8f-b253-4df9-b080-92cf8b8d7396,9474963,46559139,Animalia,Chordata,Mammalia,Carnivora,Mustelidae,Aonyx,capensis,Aonyx capensis,9474963_46559139
|
| 174 |
+
9fc4e15d-85c8-49eb-b083-c339551ef1e4,27941421,46561008,Animalia,Chordata,Chondrichthyes,Myliobatiformes,Myliobatidae,Myliobatis,aquila,Myliobatis aquila,27941421_46561008
|
| 175 |
+
54d324c0-0cf4-4ecb-a8a5-5738bc8e1f8a,9465817,326525,Animalia,Chordata,Mammalia,Primates,Lemuridae,Eulemur,fulvus,Eulemur fulvus,9465817_326525
|
eol_realign/data/rarespecies_full_manifest.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eol_realign/data/rs_links.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eol_realign/notebooks/catalog-cargo-manifest_test.ipynb
ADDED
|
@@ -0,0 +1,851 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import pandas as pd"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 2,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"TOL_FILEPATH = \"../../data/\""
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": 3,
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"outputs": [],
|
| 26 |
+
"source": [
|
| 27 |
+
"tol = pd.read_csv(TOL_FILEPATH + \"catalog.csv\", low_memory=False)"
|
| 28 |
+
]
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"cell_type": "code",
|
| 32 |
+
"execution_count": 4,
|
| 33 |
+
"metadata": {},
|
| 34 |
+
"outputs": [
|
| 35 |
+
{
|
| 36 |
+
"name": "stdout",
|
| 37 |
+
"output_type": "stream",
|
| 38 |
+
"text": [
|
| 39 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 40 |
+
"Index: 6250420 entries, 956715 to 11000930\n",
|
| 41 |
+
"Data columns (total 12 columns):\n",
|
| 42 |
+
" # Column Non-Null Count Dtype \n",
|
| 43 |
+
"--- ------ -------------- ----- \n",
|
| 44 |
+
" 0 split 6250420 non-null object\n",
|
| 45 |
+
" 1 treeoflife_id 6250420 non-null object\n",
|
| 46 |
+
" 2 eol_content_id 6250420 non-null int64 \n",
|
| 47 |
+
" 3 eol_page_id 6250420 non-null int64 \n",
|
| 48 |
+
" 4 kingdom 5989611 non-null object\n",
|
| 49 |
+
" 5 phylum 5991207 non-null object\n",
|
| 50 |
+
" 6 class 5971438 non-null object\n",
|
| 51 |
+
" 7 order 5965299 non-null object\n",
|
| 52 |
+
" 8 family 5948728 non-null object\n",
|
| 53 |
+
" 9 genus 5940313 non-null object\n",
|
| 54 |
+
" 10 species 5951613 non-null object\n",
|
| 55 |
+
" 11 common 6250420 non-null object\n",
|
| 56 |
+
"dtypes: int64(2), object(10)\n",
|
| 57 |
+
"memory usage: 619.9+ MB\n"
|
| 58 |
+
]
|
| 59 |
+
}
|
| 60 |
+
],
|
| 61 |
+
"source": [
|
| 62 |
+
"# Remove duplicates\n",
|
| 63 |
+
"tol = tol.loc[tol.split != 'train_small']\n",
|
| 64 |
+
"\n",
|
| 65 |
+
"# Reduce to just EOL data & columns\n",
|
| 66 |
+
"eol = tol.loc[tol[\"eol_content_id\"].notna()]\n",
|
| 67 |
+
"eol_cols = [col for col in list(eol.columns) if \"bioscan\" not in col and \"inat\" not in col]\n",
|
| 68 |
+
"eol_catalog = eol[eol_cols]\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"# Cast EOL content & page IDs as ints\n",
|
| 71 |
+
"eol_catalog = eol_catalog.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 72 |
+
"eol_catalog.info(show_counts = True)"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cell_type": "code",
|
| 77 |
+
"execution_count": 5,
|
| 78 |
+
"metadata": {},
|
| 79 |
+
"outputs": [],
|
| 80 |
+
"source": [
|
| 81 |
+
"archive = pd.read_csv(\"../data/checksums_media_cargo_archive.csv\", low_memory=False)"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"cell_type": "code",
|
| 86 |
+
"execution_count": 6,
|
| 87 |
+
"metadata": {},
|
| 88 |
+
"outputs": [
|
| 89 |
+
{
|
| 90 |
+
"data": {
|
| 91 |
+
"text/html": [
|
| 92 |
+
"<div>\n",
|
| 93 |
+
"<style scoped>\n",
|
| 94 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 95 |
+
" vertical-align: middle;\n",
|
| 96 |
+
" }\n",
|
| 97 |
+
"\n",
|
| 98 |
+
" .dataframe tbody tr th {\n",
|
| 99 |
+
" vertical-align: top;\n",
|
| 100 |
+
" }\n",
|
| 101 |
+
"\n",
|
| 102 |
+
" .dataframe thead th {\n",
|
| 103 |
+
" text-align: right;\n",
|
| 104 |
+
" }\n",
|
| 105 |
+
"</style>\n",
|
| 106 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 107 |
+
" <thead>\n",
|
| 108 |
+
" <tr style=\"text-align: right;\">\n",
|
| 109 |
+
" <th></th>\n",
|
| 110 |
+
" <th>split</th>\n",
|
| 111 |
+
" <th>treeoflife_id</th>\n",
|
| 112 |
+
" <th>eol_content_id_catalog</th>\n",
|
| 113 |
+
" <th>eol_page_id_catalog</th>\n",
|
| 114 |
+
" <th>kingdom</th>\n",
|
| 115 |
+
" <th>phylum</th>\n",
|
| 116 |
+
" <th>class</th>\n",
|
| 117 |
+
" <th>order</th>\n",
|
| 118 |
+
" <th>family</th>\n",
|
| 119 |
+
" <th>genus</th>\n",
|
| 120 |
+
" <th>species</th>\n",
|
| 121 |
+
" <th>common</th>\n",
|
| 122 |
+
" <th>combined_id_catalog</th>\n",
|
| 123 |
+
" </tr>\n",
|
| 124 |
+
" </thead>\n",
|
| 125 |
+
" <tbody>\n",
|
| 126 |
+
" <tr>\n",
|
| 127 |
+
" <th>956715</th>\n",
|
| 128 |
+
" <td>train</td>\n",
|
| 129 |
+
" <td>aa563519-6d97-47c3-bcda-c72cdf19a1bf</td>\n",
|
| 130 |
+
" <td>14855758</td>\n",
|
| 131 |
+
" <td>788082</td>\n",
|
| 132 |
+
" <td>Animalia</td>\n",
|
| 133 |
+
" <td>Arthropoda</td>\n",
|
| 134 |
+
" <td>Insecta</td>\n",
|
| 135 |
+
" <td>Diptera</td>\n",
|
| 136 |
+
" <td>Cecidomyiidae</td>\n",
|
| 137 |
+
" <td>Geocrypta</td>\n",
|
| 138 |
+
" <td>galii</td>\n",
|
| 139 |
+
" <td>Geocrypta galii</td>\n",
|
| 140 |
+
" <td>14855758_788082</td>\n",
|
| 141 |
+
" </tr>\n",
|
| 142 |
+
" <tr>\n",
|
| 143 |
+
" <th>956716</th>\n",
|
| 144 |
+
" <td>train</td>\n",
|
| 145 |
+
" <td>e3253a67-7114-41d5-ac55-1696d6c7f6f3</td>\n",
|
| 146 |
+
" <td>22807070</td>\n",
|
| 147 |
+
" <td>639017</td>\n",
|
| 148 |
+
" <td>Plantae</td>\n",
|
| 149 |
+
" <td>Tracheophyta</td>\n",
|
| 150 |
+
" <td>Magnoliopsida</td>\n",
|
| 151 |
+
" <td>Fabales</td>\n",
|
| 152 |
+
" <td>Fabaceae</td>\n",
|
| 153 |
+
" <td>Psoralea</td>\n",
|
| 154 |
+
" <td>lupinella</td>\n",
|
| 155 |
+
" <td>Psoralea lupinella</td>\n",
|
| 156 |
+
" <td>22807070_639017</td>\n",
|
| 157 |
+
" </tr>\n",
|
| 158 |
+
" </tbody>\n",
|
| 159 |
+
"</table>\n",
|
| 160 |
+
"</div>"
|
| 161 |
+
],
|
| 162 |
+
"text/plain": [
|
| 163 |
+
" split treeoflife_id eol_content_id_catalog \\\n",
|
| 164 |
+
"956715 train aa563519-6d97-47c3-bcda-c72cdf19a1bf 14855758 \n",
|
| 165 |
+
"956716 train e3253a67-7114-41d5-ac55-1696d6c7f6f3 22807070 \n",
|
| 166 |
+
"\n",
|
| 167 |
+
" eol_page_id_catalog kingdom phylum class order \\\n",
|
| 168 |
+
"956715 788082 Animalia Arthropoda Insecta Diptera \n",
|
| 169 |
+
"956716 639017 Plantae Tracheophyta Magnoliopsida Fabales \n",
|
| 170 |
+
"\n",
|
| 171 |
+
" family genus species common \\\n",
|
| 172 |
+
"956715 Cecidomyiidae Geocrypta galii Geocrypta galii \n",
|
| 173 |
+
"956716 Fabaceae Psoralea lupinella Psoralea lupinella \n",
|
| 174 |
+
"\n",
|
| 175 |
+
" combined_id_catalog \n",
|
| 176 |
+
"956715 14855758_788082 \n",
|
| 177 |
+
"956716 22807070_639017 "
|
| 178 |
+
]
|
| 179 |
+
},
|
| 180 |
+
"execution_count": 6,
|
| 181 |
+
"metadata": {},
|
| 182 |
+
"output_type": "execute_result"
|
| 183 |
+
}
|
| 184 |
+
],
|
| 185 |
+
"source": [
|
| 186 |
+
"# make combined ID for catalog and add suffix to eol content and page IDs\n",
|
| 187 |
+
"eol_catalog['combined_id_catalog'] = eol_catalog['eol_content_id'].astype(str) + '_' + eol_catalog['eol_page_id'].astype(str)\n",
|
| 188 |
+
"eol_catalog.rename(columns={'eol_content_id': 'eol_content_id_catalog', 'eol_page_id': 'eol_page_id_catalog'}, inplace=True)\n",
|
| 189 |
+
"eol_catalog.head(2)"
|
| 190 |
+
]
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"cell_type": "code",
|
| 194 |
+
"execution_count": 7,
|
| 195 |
+
"metadata": {},
|
| 196 |
+
"outputs": [
|
| 197 |
+
{
|
| 198 |
+
"name": "stdout",
|
| 199 |
+
"output_type": "stream",
|
| 200 |
+
"text": [
|
| 201 |
+
"archive has 6725471 entries, with columns: ['Filename', 'MD5']\n"
|
| 202 |
+
]
|
| 203 |
+
}
|
| 204 |
+
],
|
| 205 |
+
"source": [
|
| 206 |
+
"# Cargo had 6,724,838 entries\n",
|
| 207 |
+
"print(f\"archive has {archive.shape[0]} entries, with columns: {list(archive.columns)}\")"
|
| 208 |
+
]
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"cell_type": "code",
|
| 212 |
+
"execution_count": 8,
|
| 213 |
+
"metadata": {},
|
| 214 |
+
"outputs": [
|
| 215 |
+
{
|
| 216 |
+
"data": {
|
| 217 |
+
"text/html": [
|
| 218 |
+
"<div>\n",
|
| 219 |
+
"<style scoped>\n",
|
| 220 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 221 |
+
" vertical-align: middle;\n",
|
| 222 |
+
" }\n",
|
| 223 |
+
"\n",
|
| 224 |
+
" .dataframe tbody tr th {\n",
|
| 225 |
+
" vertical-align: top;\n",
|
| 226 |
+
" }\n",
|
| 227 |
+
"\n",
|
| 228 |
+
" .dataframe thead th {\n",
|
| 229 |
+
" text-align: right;\n",
|
| 230 |
+
" }\n",
|
| 231 |
+
"</style>\n",
|
| 232 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 233 |
+
" <thead>\n",
|
| 234 |
+
" <tr style=\"text-align: right;\">\n",
|
| 235 |
+
" <th></th>\n",
|
| 236 |
+
" <th>Filename</th>\n",
|
| 237 |
+
" <th>MD5</th>\n",
|
| 238 |
+
" </tr>\n",
|
| 239 |
+
" </thead>\n",
|
| 240 |
+
" <tbody>\n",
|
| 241 |
+
" <tr>\n",
|
| 242 |
+
" <th>0</th>\n",
|
| 243 |
+
" <td>29538374_65414274_eol-full-size-copy.jpg</td>\n",
|
| 244 |
+
" <td>98b1ed1430620ad50a6126cb2f9fcc74</td>\n",
|
| 245 |
+
" </tr>\n",
|
| 246 |
+
" <tr>\n",
|
| 247 |
+
" <th>1</th>\n",
|
| 248 |
+
" <td>27793900_888015_eol-full-size-copy.jpg</td>\n",
|
| 249 |
+
" <td>2de2ff12d5f339fe9d81a170749f9cb6</td>\n",
|
| 250 |
+
" </tr>\n",
|
| 251 |
+
" </tbody>\n",
|
| 252 |
+
"</table>\n",
|
| 253 |
+
"</div>"
|
| 254 |
+
],
|
| 255 |
+
"text/plain": [
|
| 256 |
+
" Filename MD5\n",
|
| 257 |
+
"0 29538374_65414274_eol-full-size-copy.jpg 98b1ed1430620ad50a6126cb2f9fcc74\n",
|
| 258 |
+
"1 27793900_888015_eol-full-size-copy.jpg 2de2ff12d5f339fe9d81a170749f9cb6"
|
| 259 |
+
]
|
| 260 |
+
},
|
| 261 |
+
"execution_count": 8,
|
| 262 |
+
"metadata": {},
|
| 263 |
+
"output_type": "execute_result"
|
| 264 |
+
}
|
| 265 |
+
],
|
| 266 |
+
"source": [
|
| 267 |
+
"archive.head(2)"
|
| 268 |
+
]
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"cell_type": "code",
|
| 272 |
+
"execution_count": 9,
|
| 273 |
+
"metadata": {},
|
| 274 |
+
"outputs": [],
|
| 275 |
+
"source": [
|
| 276 |
+
"def get_combined_id(filename):\n",
|
| 277 |
+
" return filename.split(\"_e\")[0]"
|
| 278 |
+
]
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"cell_type": "code",
|
| 282 |
+
"execution_count": 10,
|
| 283 |
+
"metadata": {},
|
| 284 |
+
"outputs": [],
|
| 285 |
+
"source": [
|
| 286 |
+
"archive[\"combined_id\"] = archive[\"Filename\"].apply(get_combined_id)"
|
| 287 |
+
]
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"cell_type": "markdown",
|
| 291 |
+
"metadata": {},
|
| 292 |
+
"source": [
|
| 293 |
+
"Merge catalog with archive (sanity check on our images since the cargo didn't match with all of catalog)."
|
| 294 |
+
]
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"cell_type": "code",
|
| 298 |
+
"execution_count": 11,
|
| 299 |
+
"metadata": {},
|
| 300 |
+
"outputs": [
|
| 301 |
+
{
|
| 302 |
+
"name": "stdout",
|
| 303 |
+
"output_type": "stream",
|
| 304 |
+
"text": [
|
| 305 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 306 |
+
"RangeIndex: 6250420 entries, 0 to 6250419\n",
|
| 307 |
+
"Data columns (total 16 columns):\n",
|
| 308 |
+
" # Column Non-Null Count Dtype \n",
|
| 309 |
+
"--- ------ -------------- ----- \n",
|
| 310 |
+
" 0 split 6250420 non-null object\n",
|
| 311 |
+
" 1 treeoflife_id 6250420 non-null object\n",
|
| 312 |
+
" 2 eol_content_id_catalog 6250420 non-null int64 \n",
|
| 313 |
+
" 3 eol_page_id_catalog 6250420 non-null int64 \n",
|
| 314 |
+
" 4 kingdom 5989611 non-null object\n",
|
| 315 |
+
" 5 phylum 5991207 non-null object\n",
|
| 316 |
+
" 6 class 5971438 non-null object\n",
|
| 317 |
+
" 7 order 5965299 non-null object\n",
|
| 318 |
+
" 8 family 5948728 non-null object\n",
|
| 319 |
+
" 9 genus 5940313 non-null object\n",
|
| 320 |
+
" 10 species 5951613 non-null object\n",
|
| 321 |
+
" 11 common 6250420 non-null object\n",
|
| 322 |
+
" 12 combined_id_catalog 6250420 non-null object\n",
|
| 323 |
+
" 13 Filename 6250420 non-null object\n",
|
| 324 |
+
" 14 MD5 6250420 non-null object\n",
|
| 325 |
+
" 15 combined_id 6250420 non-null object\n",
|
| 326 |
+
"dtypes: int64(2), object(14)\n",
|
| 327 |
+
"memory usage: 763.0+ MB\n"
|
| 328 |
+
]
|
| 329 |
+
}
|
| 330 |
+
],
|
| 331 |
+
"source": [
|
| 332 |
+
"catalog_archive = pd.merge(eol_catalog,\n",
|
| 333 |
+
" archive,\n",
|
| 334 |
+
" left_on = \"combined_id_catalog\",\n",
|
| 335 |
+
" right_on = \"combined_id\",\n",
|
| 336 |
+
" how=\"inner\"\n",
|
| 337 |
+
" )\n",
|
| 338 |
+
"catalog_archive.info(show_counts = True)"
|
| 339 |
+
]
|
| 340 |
+
},
|
| 341 |
+
{
|
| 342 |
+
"cell_type": "markdown",
|
| 343 |
+
"metadata": {},
|
| 344 |
+
"source": [
|
| 345 |
+
"Sanity check confirmed: Everything in the catalog is captured in our cargo archive."
|
| 346 |
+
]
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"cell_type": "markdown",
|
| 350 |
+
"metadata": {},
|
| 351 |
+
"source": [
|
| 352 |
+
"Pull in combined manifest with checksums to merge on the archive checksums."
|
| 353 |
+
]
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"cell_type": "code",
|
| 357 |
+
"execution_count": 3,
|
| 358 |
+
"metadata": {},
|
| 359 |
+
"outputs": [
|
| 360 |
+
{
|
| 361 |
+
"data": {
|
| 362 |
+
"text/plain": [
|
| 363 |
+
"Index(['filename_manifest', 'md5_combined_manifest',\n",
|
| 364 |
+
" 'combined_id_manifest_redownload', 'eol_content_id', 'eol_page_id',\n",
|
| 365 |
+
" 'medium_source_url', 'eol_full_size_copy_url', 'license_name',\n",
|
| 366 |
+
" 'copyright_owner', 'expected_image_filename', 'source_0706',\n",
|
| 367 |
+
" 'source_0726', 'source_1206', 'combined_id_full_manifest'],\n",
|
| 368 |
+
" dtype='object')"
|
| 369 |
+
]
|
| 370 |
+
},
|
| 371 |
+
"execution_count": 3,
|
| 372 |
+
"metadata": {},
|
| 373 |
+
"output_type": "execute_result"
|
| 374 |
+
}
|
| 375 |
+
],
|
| 376 |
+
"source": [
|
| 377 |
+
"manifests = pd.read_csv(\"../data/combined_manifest_with_checksums.csv\", low_memory=False)\n",
|
| 378 |
+
"manifests.columns"
|
| 379 |
+
]
|
| 380 |
+
},
|
| 381 |
+
{
|
| 382 |
+
"cell_type": "code",
|
| 383 |
+
"execution_count": 13,
|
| 384 |
+
"metadata": {},
|
| 385 |
+
"outputs": [
|
| 386 |
+
{
|
| 387 |
+
"name": "stdout",
|
| 388 |
+
"output_type": "stream",
|
| 389 |
+
"text": [
|
| 390 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 391 |
+
"RangeIndex: 6841202 entries, 0 to 6841201\n",
|
| 392 |
+
"Data columns (total 30 columns):\n",
|
| 393 |
+
" # Column Non-Null Count Dtype \n",
|
| 394 |
+
"--- ------ -------------- ----- \n",
|
| 395 |
+
" 0 split 6841202 non-null object\n",
|
| 396 |
+
" 1 treeoflife_id 6841202 non-null object\n",
|
| 397 |
+
" 2 eol_content_id_catalog 6841202 non-null int64 \n",
|
| 398 |
+
" 3 eol_page_id_catalog 6841202 non-null int64 \n",
|
| 399 |
+
" 4 kingdom 6551473 non-null object\n",
|
| 400 |
+
" 5 phylum 6553206 non-null object\n",
|
| 401 |
+
" 6 class 6532009 non-null object\n",
|
| 402 |
+
" 7 order 6525621 non-null object\n",
|
| 403 |
+
" 8 family 6506076 non-null object\n",
|
| 404 |
+
" 9 genus 6486130 non-null object\n",
|
| 405 |
+
" 10 species 6406307 non-null object\n",
|
| 406 |
+
" 11 common 6841202 non-null object\n",
|
| 407 |
+
" 12 combined_id_catalog 6841202 non-null object\n",
|
| 408 |
+
" 13 Filename 6841202 non-null object\n",
|
| 409 |
+
" 14 MD5 6841202 non-null object\n",
|
| 410 |
+
" 15 combined_id 6841202 non-null object\n",
|
| 411 |
+
" 16 filename_manifest 6841202 non-null object\n",
|
| 412 |
+
" 17 md5_combined_manifest 6841202 non-null object\n",
|
| 413 |
+
" 18 combined_id_manifest_redownload 6841202 non-null object\n",
|
| 414 |
+
" 19 eol_content_id 6841202 non-null int64 \n",
|
| 415 |
+
" 20 eol_page_id 6841202 non-null int64 \n",
|
| 416 |
+
" 21 medium_source_url 6841202 non-null object\n",
|
| 417 |
+
" 22 eol_full_size_copy_url 6841202 non-null object\n",
|
| 418 |
+
" 23 license_name 6841202 non-null object\n",
|
| 419 |
+
" 24 copyright_owner 6208498 non-null object\n",
|
| 420 |
+
" 25 expected_image_filename 6841202 non-null object\n",
|
| 421 |
+
" 26 source_0706 6841202 non-null bool \n",
|
| 422 |
+
" 27 source_0726 6841202 non-null bool \n",
|
| 423 |
+
" 28 source_1206 6841202 non-null bool \n",
|
| 424 |
+
" 29 combined_id_full_manifest 6841202 non-null object\n",
|
| 425 |
+
"dtypes: bool(3), int64(4), object(23)\n",
|
| 426 |
+
"memory usage: 1.4+ GB\n"
|
| 427 |
+
]
|
| 428 |
+
}
|
| 429 |
+
],
|
| 430 |
+
"source": [
|
| 431 |
+
"catalog_archive_manifest = pd.merge(catalog_archive,\n",
|
| 432 |
+
" manifests,\n",
|
| 433 |
+
" left_on = \"MD5\",\n",
|
| 434 |
+
" right_on = \"md5_combined_manifest\",\n",
|
| 435 |
+
" how = \"inner\",\n",
|
| 436 |
+
" suffixes=(\"\",\"_manifests\")\n",
|
| 437 |
+
" )\n",
|
| 438 |
+
"catalog_archive_manifest.info(show_counts = True)"
|
| 439 |
+
]
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"cell_type": "code",
|
| 443 |
+
"execution_count": 14,
|
| 444 |
+
"metadata": {},
|
| 445 |
+
"outputs": [
|
| 446 |
+
{
|
| 447 |
+
"data": {
|
| 448 |
+
"text/plain": [
|
| 449 |
+
"6219674"
|
| 450 |
+
]
|
| 451 |
+
},
|
| 452 |
+
"execution_count": 14,
|
| 453 |
+
"metadata": {},
|
| 454 |
+
"output_type": "execute_result"
|
| 455 |
+
}
|
| 456 |
+
],
|
| 457 |
+
"source": [
|
| 458 |
+
"catalog_archive_manifest.treeoflife_id.nunique()"
|
| 459 |
+
]
|
| 460 |
+
},
|
| 461 |
+
{
|
| 462 |
+
"cell_type": "markdown",
|
| 463 |
+
"metadata": {},
|
| 464 |
+
"source": [
|
| 465 |
+
"Only 6,219,674 of our 6,250,420 images were able to be pulled through the combined manifests."
|
| 466 |
+
]
|
| 467 |
+
},
|
| 468 |
+
{
|
| 469 |
+
"cell_type": "markdown",
|
| 470 |
+
"metadata": {},
|
| 471 |
+
"source": [
|
| 472 |
+
"### Align Owners to Manifest"
|
| 473 |
+
]
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"cell_type": "code",
|
| 477 |
+
"execution_count": 7,
|
| 478 |
+
"metadata": {},
|
| 479 |
+
"outputs": [],
|
| 480 |
+
"source": [
|
| 481 |
+
"owner_df = pd.read_csv(\"../data/media_manifest_missing_licenses_jul26_owners.csv\",\n",
|
| 482 |
+
" low_memory=False,\n",
|
| 483 |
+
" dtype={\"EOL content ID\": \"int64\", \"EOL page ID\": \"int64\"},)"
|
| 484 |
+
]
|
| 485 |
+
},
|
| 486 |
+
{
|
| 487 |
+
"cell_type": "markdown",
|
| 488 |
+
"metadata": {},
|
| 489 |
+
"source": [
|
| 490 |
+
"try merge then fill and concatenate."
|
| 491 |
+
]
|
| 492 |
+
},
|
| 493 |
+
{
|
| 494 |
+
"cell_type": "code",
|
| 495 |
+
"execution_count": 8,
|
| 496 |
+
"metadata": {},
|
| 497 |
+
"outputs": [
|
| 498 |
+
{
|
| 499 |
+
"name": "stdout",
|
| 500 |
+
"output_type": "stream",
|
| 501 |
+
"text": [
|
| 502 |
+
"['filename_manifest', 'md5_combined_manifest', 'combined_id_manifest_redownload', 'eol_content_id', 'eol_page_id', 'medium_source_url', 'eol_full_size_copy_url', 'license_name', 'copyright_owner', 'expected_image_filename', 'source_0706', 'source_0726', 'source_1206', 'combined_id_full_manifest']\n",
|
| 503 |
+
"['EOL content ID', 'EOL page ID', 'Medium Source URL', 'EOL Full-Size Copy URL', 'License Name', 'Copyright Owner', 'license_link', 'title']\n"
|
| 504 |
+
]
|
| 505 |
+
}
|
| 506 |
+
],
|
| 507 |
+
"source": [
|
| 508 |
+
"print(list(manifests.columns))\n",
|
| 509 |
+
"print(list(owner_df.columns))"
|
| 510 |
+
]
|
| 511 |
+
},
|
| 512 |
+
{
|
| 513 |
+
"cell_type": "code",
|
| 514 |
+
"execution_count": 23,
|
| 515 |
+
"metadata": {},
|
| 516 |
+
"outputs": [
|
| 517 |
+
{
|
| 518 |
+
"name": "stdout",
|
| 519 |
+
"output_type": "stream",
|
| 520 |
+
"text": [
|
| 521 |
+
"There are 12330062 entries in the combined manifest\n",
|
| 522 |
+
"There are 632043 entries in the owner match CSV\n"
|
| 523 |
+
]
|
| 524 |
+
}
|
| 525 |
+
],
|
| 526 |
+
"source": [
|
| 527 |
+
"print(f\"There are {manifests.shape[0]} entries in the combined manifest\")\n",
|
| 528 |
+
"print(f\"There are {owner_df.shape[0]} entries in the owner match CSV\")"
|
| 529 |
+
]
|
| 530 |
+
},
|
| 531 |
+
{
|
| 532 |
+
"cell_type": "code",
|
| 533 |
+
"execution_count": 9,
|
| 534 |
+
"metadata": {},
|
| 535 |
+
"outputs": [],
|
| 536 |
+
"source": [
|
| 537 |
+
"owner_df[\"combined_id_owner\"] = owner_df[\"EOL content ID\"].astype(str) + \"_\" + owner_df[\"EOL page ID\"].astype(str)\n"
|
| 538 |
+
]
|
| 539 |
+
},
|
| 540 |
+
{
|
| 541 |
+
"cell_type": "code",
|
| 542 |
+
"execution_count": 15,
|
| 543 |
+
"metadata": {},
|
| 544 |
+
"outputs": [
|
| 545 |
+
{
|
| 546 |
+
"name": "stdout",
|
| 547 |
+
"output_type": "stream",
|
| 548 |
+
"text": [
|
| 549 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 550 |
+
"RangeIndex: 630056 entries, 0 to 630055\n",
|
| 551 |
+
"Data columns (total 23 columns):\n",
|
| 552 |
+
" # Column Non-Null Count Dtype \n",
|
| 553 |
+
"--- ------ -------------- ----- \n",
|
| 554 |
+
" 0 EOL content ID 630056 non-null int64 \n",
|
| 555 |
+
" 1 EOL page ID 630056 non-null int64 \n",
|
| 556 |
+
" 2 Medium Source URL 630056 non-null object\n",
|
| 557 |
+
" 3 EOL Full-Size Copy URL 630056 non-null object\n",
|
| 558 |
+
" 4 License Name 630056 non-null object\n",
|
| 559 |
+
" 5 Copyright Owner 611829 non-null object\n",
|
| 560 |
+
" 6 license_link 619741 non-null object\n",
|
| 561 |
+
" 7 title 604447 non-null object\n",
|
| 562 |
+
" 8 combined_id_owner 630056 non-null object\n",
|
| 563 |
+
" 9 filename_manifest 630056 non-null object\n",
|
| 564 |
+
" 10 md5_combined_manifest 630056 non-null object\n",
|
| 565 |
+
" 11 combined_id_manifest_redownload 630056 non-null object\n",
|
| 566 |
+
" 12 eol_content_id 630056 non-null int64 \n",
|
| 567 |
+
" 13 eol_page_id 630056 non-null int64 \n",
|
| 568 |
+
" 14 medium_source_url 630056 non-null object\n",
|
| 569 |
+
" 15 eol_full_size_copy_url 630056 non-null object\n",
|
| 570 |
+
" 16 license_name 630056 non-null object\n",
|
| 571 |
+
" 17 copyright_owner 0 non-null object\n",
|
| 572 |
+
" 18 expected_image_filename 630056 non-null object\n",
|
| 573 |
+
" 19 source_0706 630056 non-null bool \n",
|
| 574 |
+
" 20 source_0726 630056 non-null bool \n",
|
| 575 |
+
" 21 source_1206 630056 non-null bool \n",
|
| 576 |
+
" 22 combined_id_full_manifest 630056 non-null object\n",
|
| 577 |
+
"dtypes: bool(3), int64(4), object(16)\n",
|
| 578 |
+
"memory usage: 97.9+ MB\n"
|
| 579 |
+
]
|
| 580 |
+
}
|
| 581 |
+
],
|
| 582 |
+
"source": [
|
| 583 |
+
"owners_manifest = pd.merge(owner_df,\n",
|
| 584 |
+
" manifests,\n",
|
| 585 |
+
" left_on=\"combined_id_owner\",\n",
|
| 586 |
+
" right_on = \"combined_id_full_manifest\",\n",
|
| 587 |
+
" how = \"inner\")\n",
|
| 588 |
+
"owners_manifest.info()"
|
| 589 |
+
]
|
| 590 |
+
},
|
| 591 |
+
{
|
| 592 |
+
"cell_type": "code",
|
| 593 |
+
"execution_count": 16,
|
| 594 |
+
"metadata": {},
|
| 595 |
+
"outputs": [
|
| 596 |
+
{
|
| 597 |
+
"name": "stdout",
|
| 598 |
+
"output_type": "stream",
|
| 599 |
+
"text": [
|
| 600 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 601 |
+
"RangeIndex: 630056 entries, 0 to 630055\n",
|
| 602 |
+
"Data columns (total 23 columns):\n",
|
| 603 |
+
" # Column Non-Null Count Dtype \n",
|
| 604 |
+
"--- ------ -------------- ----- \n",
|
| 605 |
+
" 0 EOL content ID 630056 non-null int64 \n",
|
| 606 |
+
" 1 EOL page ID 630056 non-null int64 \n",
|
| 607 |
+
" 2 Medium Source URL 630056 non-null object\n",
|
| 608 |
+
" 3 EOL Full-Size Copy URL 630056 non-null object\n",
|
| 609 |
+
" 4 License Name 630056 non-null object\n",
|
| 610 |
+
" 5 Copyright Owner 611829 non-null object\n",
|
| 611 |
+
" 6 license_link 619741 non-null object\n",
|
| 612 |
+
" 7 title 604447 non-null object\n",
|
| 613 |
+
" 8 combined_id_owner 630056 non-null object\n",
|
| 614 |
+
" 9 filename_manifest 630056 non-null object\n",
|
| 615 |
+
" 10 md5_combined_manifest 630056 non-null object\n",
|
| 616 |
+
" 11 combined_id_manifest_redownload 630056 non-null object\n",
|
| 617 |
+
" 12 eol_content_id 630056 non-null int64 \n",
|
| 618 |
+
" 13 eol_page_id 630056 non-null int64 \n",
|
| 619 |
+
" 14 medium_source_url 630056 non-null object\n",
|
| 620 |
+
" 15 eol_full_size_copy_url 630056 non-null object\n",
|
| 621 |
+
" 16 license_name 630056 non-null object\n",
|
| 622 |
+
" 17 copyright_owner 611829 non-null object\n",
|
| 623 |
+
" 18 expected_image_filename 630056 non-null object\n",
|
| 624 |
+
" 19 source_0706 630056 non-null bool \n",
|
| 625 |
+
" 20 source_0726 630056 non-null bool \n",
|
| 626 |
+
" 21 source_1206 630056 non-null bool \n",
|
| 627 |
+
" 22 combined_id_full_manifest 630056 non-null object\n",
|
| 628 |
+
"dtypes: bool(3), int64(4), object(16)\n",
|
| 629 |
+
"memory usage: 97.9+ MB\n"
|
| 630 |
+
]
|
| 631 |
+
}
|
| 632 |
+
],
|
| 633 |
+
"source": [
|
| 634 |
+
"owners_manifest[\"copyright_owner\"] = owners_manifest[\"Copyright Owner\"]\n",
|
| 635 |
+
"owners_manifest.info(show_counts=True)"
|
| 636 |
+
]
|
| 637 |
+
},
|
| 638 |
+
{
|
| 639 |
+
"cell_type": "code",
|
| 640 |
+
"execution_count": 17,
|
| 641 |
+
"metadata": {},
|
| 642 |
+
"outputs": [
|
| 643 |
+
{
|
| 644 |
+
"data": {
|
| 645 |
+
"text/plain": [
|
| 646 |
+
"Index(['filename_manifest', 'md5_combined_manifest',\n",
|
| 647 |
+
" 'combined_id_manifest_redownload', 'eol_content_id', 'eol_page_id',\n",
|
| 648 |
+
" 'medium_source_url', 'eol_full_size_copy_url', 'license_name',\n",
|
| 649 |
+
" 'copyright_owner', 'expected_image_filename', 'source_0706',\n",
|
| 650 |
+
" 'source_0726', 'source_1206', 'combined_id_full_manifest', 'title'],\n",
|
| 651 |
+
" dtype='object')"
|
| 652 |
+
]
|
| 653 |
+
},
|
| 654 |
+
"execution_count": 17,
|
| 655 |
+
"metadata": {},
|
| 656 |
+
"output_type": "execute_result"
|
| 657 |
+
}
|
| 658 |
+
],
|
| 659 |
+
"source": [
|
| 660 |
+
"license_cols = list(manifests.columns)\n",
|
| 661 |
+
"license_cols.append(\"title\")\n",
|
| 662 |
+
"owners_manifest = owners_manifest[license_cols]\n",
|
| 663 |
+
"owners_manifest.columns"
|
| 664 |
+
]
|
| 665 |
+
},
|
| 666 |
+
{
|
| 667 |
+
"cell_type": "code",
|
| 668 |
+
"execution_count": 13,
|
| 669 |
+
"metadata": {},
|
| 670 |
+
"outputs": [
|
| 671 |
+
{
|
| 672 |
+
"data": {
|
| 673 |
+
"text/plain": [
|
| 674 |
+
"630056"
|
| 675 |
+
]
|
| 676 |
+
},
|
| 677 |
+
"execution_count": 13,
|
| 678 |
+
"metadata": {},
|
| 679 |
+
"output_type": "execute_result"
|
| 680 |
+
}
|
| 681 |
+
],
|
| 682 |
+
"source": [
|
| 683 |
+
"rematched_owner_ids = list(owners_manifest.combined_id_full_manifest.unique())\n",
|
| 684 |
+
"len(rematched_owner_ids)"
|
| 685 |
+
]
|
| 686 |
+
},
|
| 687 |
+
{
|
| 688 |
+
"cell_type": "code",
|
| 689 |
+
"execution_count": 14,
|
| 690 |
+
"metadata": {},
|
| 691 |
+
"outputs": [
|
| 692 |
+
{
|
| 693 |
+
"data": {
|
| 694 |
+
"text/plain": [
|
| 695 |
+
"(11700006, 14)"
|
| 696 |
+
]
|
| 697 |
+
},
|
| 698 |
+
"execution_count": 14,
|
| 699 |
+
"metadata": {},
|
| 700 |
+
"output_type": "execute_result"
|
| 701 |
+
}
|
| 702 |
+
],
|
| 703 |
+
"source": [
|
| 704 |
+
"un_matched_owner_manifest = manifests.loc[~manifests.combined_id_full_manifest.isin(rematched_owner_ids)]\n",
|
| 705 |
+
"un_matched_owner_manifest.shape"
|
| 706 |
+
]
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
"cell_type": "code",
|
| 710 |
+
"execution_count": 18,
|
| 711 |
+
"metadata": {},
|
| 712 |
+
"outputs": [
|
| 713 |
+
{
|
| 714 |
+
"name": "stderr",
|
| 715 |
+
"output_type": "stream",
|
| 716 |
+
"text": [
|
| 717 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_4207/1002247400.py:1: SettingWithCopyWarning: \n",
|
| 718 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 719 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 720 |
+
"\n",
|
| 721 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 722 |
+
" un_matched_owner_manifest[\"title\"] = \"not provided\"\n"
|
| 723 |
+
]
|
| 724 |
+
}
|
| 725 |
+
],
|
| 726 |
+
"source": [
|
| 727 |
+
"un_matched_owner_manifest[\"title\"] = \"not provided\""
|
| 728 |
+
]
|
| 729 |
+
},
|
| 730 |
+
{
|
| 731 |
+
"cell_type": "code",
|
| 732 |
+
"execution_count": 19,
|
| 733 |
+
"metadata": {},
|
| 734 |
+
"outputs": [
|
| 735 |
+
{
|
| 736 |
+
"name": "stdout",
|
| 737 |
+
"output_type": "stream",
|
| 738 |
+
"text": [
|
| 739 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 740 |
+
"RangeIndex: 12330062 entries, 0 to 12330061\n",
|
| 741 |
+
"Data columns (total 15 columns):\n",
|
| 742 |
+
" # Column Non-Null Count Dtype \n",
|
| 743 |
+
"--- ------ -------------- ----- \n",
|
| 744 |
+
" 0 filename_manifest 12330062 non-null object\n",
|
| 745 |
+
" 1 md5_combined_manifest 12330062 non-null object\n",
|
| 746 |
+
" 2 combined_id_manifest_redownload 12330062 non-null object\n",
|
| 747 |
+
" 3 eol_content_id 12330062 non-null int64 \n",
|
| 748 |
+
" 4 eol_page_id 12330062 non-null int64 \n",
|
| 749 |
+
" 5 medium_source_url 12330062 non-null object\n",
|
| 750 |
+
" 6 eol_full_size_copy_url 12330062 non-null object\n",
|
| 751 |
+
" 7 license_name 12330062 non-null object\n",
|
| 752 |
+
" 8 copyright_owner 11544885 non-null object\n",
|
| 753 |
+
" 9 expected_image_filename 12330062 non-null object\n",
|
| 754 |
+
" 10 source_0706 12330062 non-null bool \n",
|
| 755 |
+
" 11 source_0726 12330062 non-null bool \n",
|
| 756 |
+
" 12 source_1206 12330062 non-null bool \n",
|
| 757 |
+
" 13 combined_id_full_manifest 12330062 non-null object\n",
|
| 758 |
+
" 14 title 12304453 non-null object\n",
|
| 759 |
+
"dtypes: bool(3), int64(2), object(10)\n",
|
| 760 |
+
"memory usage: 1.1+ GB\n"
|
| 761 |
+
]
|
| 762 |
+
}
|
| 763 |
+
],
|
| 764 |
+
"source": [
|
| 765 |
+
"full_owner_manifest = pd.concat([un_matched_owner_manifest, owners_manifest], ignore_index=True)\n",
|
| 766 |
+
"full_owner_manifest.info(show_counts = True)"
|
| 767 |
+
]
|
| 768 |
+
},
|
| 769 |
+
{
|
| 770 |
+
"cell_type": "code",
|
| 771 |
+
"execution_count": 20,
|
| 772 |
+
"metadata": {},
|
| 773 |
+
"outputs": [
|
| 774 |
+
{
|
| 775 |
+
"name": "stdout",
|
| 776 |
+
"output_type": "stream",
|
| 777 |
+
"text": [
|
| 778 |
+
"Licenses still missing Copyright Owners: \n",
|
| 779 |
+
" license_name\n",
|
| 780 |
+
"cc-by-3.0 262894\n",
|
| 781 |
+
"cc-publicdomain 262803\n",
|
| 782 |
+
"cc-by-nc-sa-3.0 122493\n",
|
| 783 |
+
"cc-by-sa-3.0 93303\n",
|
| 784 |
+
"No known copyright restrictions 31025\n",
|
| 785 |
+
"cc-by-nc 12619\n",
|
| 786 |
+
"cc-0-1.0 32\n",
|
| 787 |
+
"cc-by-nc-2.0 5\n",
|
| 788 |
+
"cc-by-nc-4.0 2\n",
|
| 789 |
+
"cc-by-nc-sa 1\n",
|
| 790 |
+
"Name: count, dtype: int64\n"
|
| 791 |
+
]
|
| 792 |
+
}
|
| 793 |
+
],
|
| 794 |
+
"source": [
|
| 795 |
+
"print(\n",
|
| 796 |
+
" \"Licenses still missing Copyright Owners: \\n\",\n",
|
| 797 |
+
" full_owner_manifest.loc[\n",
|
| 798 |
+
" full_owner_manifest[\"copyright_owner\"].isna(), \"license_name\"\n",
|
| 799 |
+
" ].value_counts(),\n",
|
| 800 |
+
" )"
|
| 801 |
+
]
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"cell_type": "code",
|
| 805 |
+
"execution_count": 21,
|
| 806 |
+
"metadata": {},
|
| 807 |
+
"outputs": [],
|
| 808 |
+
"source": [
|
| 809 |
+
"full_owner_manifest[\"copyright_owner\"].fillna(\"not provided\", inplace=True)\n",
|
| 810 |
+
"full_owner_manifest[\"title\"].fillna(\"not provided\", inplace=True)"
|
| 811 |
+
]
|
| 812 |
+
},
|
| 813 |
+
{
|
| 814 |
+
"cell_type": "code",
|
| 815 |
+
"execution_count": 22,
|
| 816 |
+
"metadata": {},
|
| 817 |
+
"outputs": [],
|
| 818 |
+
"source": [
|
| 819 |
+
"full_owner_manifest.to_csv(\"../data/full_owner_manifest.csv\", index = False)"
|
| 820 |
+
]
|
| 821 |
+
},
|
| 822 |
+
{
|
| 823 |
+
"cell_type": "code",
|
| 824 |
+
"execution_count": null,
|
| 825 |
+
"metadata": {},
|
| 826 |
+
"outputs": [],
|
| 827 |
+
"source": []
|
| 828 |
+
}
|
| 829 |
+
],
|
| 830 |
+
"metadata": {
|
| 831 |
+
"kernelspec": {
|
| 832 |
+
"display_name": "std",
|
| 833 |
+
"language": "python",
|
| 834 |
+
"name": "python3"
|
| 835 |
+
},
|
| 836 |
+
"language_info": {
|
| 837 |
+
"codemirror_mode": {
|
| 838 |
+
"name": "ipython",
|
| 839 |
+
"version": 3
|
| 840 |
+
},
|
| 841 |
+
"file_extension": ".py",
|
| 842 |
+
"mimetype": "text/x-python",
|
| 843 |
+
"name": "python",
|
| 844 |
+
"nbconvert_exporter": "python",
|
| 845 |
+
"pygments_lexer": "ipython3",
|
| 846 |
+
"version": "3.11.3"
|
| 847 |
+
}
|
| 848 |
+
},
|
| 849 |
+
"nbformat": 4,
|
| 850 |
+
"nbformat_minor": 2
|
| 851 |
+
}
|
eol_realign/notebooks/links_align_reduced.ipynb
ADDED
|
@@ -0,0 +1,1253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import pandas as pd"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 2,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"TOL_FILEPATH = \"../../data/\""
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "markdown",
|
| 23 |
+
"metadata": {},
|
| 24 |
+
"source": [
|
| 25 |
+
"### Read in Links CSV files\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"Full cargo archives have some more content than the [original `links_inner` file](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_inner.csv) and the [original `links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv).\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"From Matt:\n",
|
| 30 |
+
"> It represents a series of inner merges:\n",
|
| 31 |
+
"> 1. The list of images in the EOL cargo archive (used to create the webdatasets) with the EOL portion of `catalog.csv`\n",
|
| 32 |
+
"> - Merged on a combined identifier of `eol_content_id` and `eol_page_id`.\n",
|
| 33 |
+
"> Result from 1) with the list of images redownloaded from all 3 media manifests we touched around the original download time (identified [here](https://huggingface.co/datasets/imageomics/ToL-EDA/discussions/5#6584808d92eba5ad69b8379f)).\n",
|
| 34 |
+
"> - Merged on MD5\n",
|
| 35 |
+
">\n",
|
| 36 |
+
"> The result has 6,219,674 unique `treeoflife_id` entries and 6,146,917 unique `md5` entries. It has the combined `eol_content_id` and `eol_page_id` identifiers used at each stage:\n",
|
| 37 |
+
"- `combined_id_catalog`: represents what's in the original catalog \n",
|
| 38 |
+
"- `combined_id_manifest_full_manifest`: represents what's in the combined manifest from all 3 dates \n",
|
| 39 |
+
"> It also has an indicator of which of the three media manifest files each entry was present in (one or more) in columns representing retreival date (eg., `source_0706`: indicates if it was present in the manifest retrieved on July 6, 2023). It also has the copyright owner and license information as contained in the media manifest files.\n",
|
| 40 |
+
">\n",
|
| 41 |
+
"> Still needs to be run through the owner name finding code. ([owner_match](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/71ad5b49226a3a49634931005eeb340b3c96db13/scripts/match_owners.py) --note: this version uses inner merges, so will remove entries without media info. Probably should adjust this.)\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"For reference on the numbers, there are 6,250,420 EOL images in TreeOfLife-10M (the catalog). Comparing with `links_inner` previously (from [`links_inner.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_inner.csv)) we were missing 31,376 images, 29 of which were identified in [`links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv)."
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"cell_type": "code",
|
| 48 |
+
"execution_count": 3,
|
| 49 |
+
"metadata": {},
|
| 50 |
+
"outputs": [],
|
| 51 |
+
"source": [
|
| 52 |
+
"links_inner = pd.read_csv(\"../data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv\", low_memory=False)\n",
|
| 53 |
+
"links_manifest_cargo = pd.read_csv(\"../data/eol-cargo-archive_combined-manifest-checksums_links.csv\", low_memory=False)"
|
| 54 |
+
]
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"cell_type": "code",
|
| 58 |
+
"execution_count": 4,
|
| 59 |
+
"metadata": {},
|
| 60 |
+
"outputs": [
|
| 61 |
+
{
|
| 62 |
+
"name": "stdout",
|
| 63 |
+
"output_type": "stream",
|
| 64 |
+
"text": [
|
| 65 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 66 |
+
"RangeIndex: 6841202 entries, 0 to 6841201\n",
|
| 67 |
+
"Data columns (total 30 columns):\n",
|
| 68 |
+
" # Column Non-Null Count Dtype \n",
|
| 69 |
+
"--- ------ -------------- ----- \n",
|
| 70 |
+
" 0 filename_archive 6841202 non-null object \n",
|
| 71 |
+
" 1 md5 6841202 non-null object \n",
|
| 72 |
+
" 2 combined_id_archive 6841202 non-null object \n",
|
| 73 |
+
" 3 split 6841202 non-null object \n",
|
| 74 |
+
" 4 treeoflife_id 6841202 non-null object \n",
|
| 75 |
+
" 5 bioscan_part 0 non-null float64\n",
|
| 76 |
+
" 6 bioscan_filename 0 non-null float64\n",
|
| 77 |
+
" 7 inat21_filename 0 non-null float64\n",
|
| 78 |
+
" 8 inat21_cls_name 0 non-null float64\n",
|
| 79 |
+
" 9 inat21_cls_num 0 non-null float64\n",
|
| 80 |
+
" 10 kingdom 6551473 non-null object \n",
|
| 81 |
+
" 11 phylum 6553206 non-null object \n",
|
| 82 |
+
" 12 class 6532009 non-null object \n",
|
| 83 |
+
" 13 order 6525621 non-null object \n",
|
| 84 |
+
" 14 family 6506076 non-null object \n",
|
| 85 |
+
" 15 genus 6486130 non-null object \n",
|
| 86 |
+
" 16 species 6406307 non-null object \n",
|
| 87 |
+
" 17 common 6841202 non-null object \n",
|
| 88 |
+
" 18 combined_id_catalog 6841202 non-null object \n",
|
| 89 |
+
" 19 filename_manifest 6841202 non-null object \n",
|
| 90 |
+
" 20 combined_id_manifest_redownload 6841202 non-null object \n",
|
| 91 |
+
" 21 medium_source_url 6841202 non-null object \n",
|
| 92 |
+
" 22 eol_full_size_copy_url 6841202 non-null object \n",
|
| 93 |
+
" 23 license_name 6841202 non-null object \n",
|
| 94 |
+
" 24 copyright_owner 6208498 non-null object \n",
|
| 95 |
+
" 25 expected_image_filename 6841202 non-null object \n",
|
| 96 |
+
" 26 source_0706 6841202 non-null bool \n",
|
| 97 |
+
" 27 source_0726 6841202 non-null bool \n",
|
| 98 |
+
" 28 source_1206 6841202 non-null bool \n",
|
| 99 |
+
" 29 combined_id_full_manifest 6841202 non-null object \n",
|
| 100 |
+
"dtypes: bool(3), float64(5), object(22)\n",
|
| 101 |
+
"memory usage: 1.4+ GB\n"
|
| 102 |
+
]
|
| 103 |
+
}
|
| 104 |
+
],
|
| 105 |
+
"source": [
|
| 106 |
+
"links_inner.info(show_counts=True)"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"cell_type": "code",
|
| 111 |
+
"execution_count": 5,
|
| 112 |
+
"metadata": {},
|
| 113 |
+
"outputs": [
|
| 114 |
+
{
|
| 115 |
+
"name": "stdout",
|
| 116 |
+
"output_type": "stream",
|
| 117 |
+
"text": [
|
| 118 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 119 |
+
"RangeIndex: 7514001 entries, 0 to 7514000\n",
|
| 120 |
+
"Data columns (total 17 columns):\n",
|
| 121 |
+
" # Column Non-Null Count Dtype \n",
|
| 122 |
+
"--- ------ -------------- ----- \n",
|
| 123 |
+
" 0 filename_archive 7514001 non-null object\n",
|
| 124 |
+
" 1 md5_archive 7514001 non-null object\n",
|
| 125 |
+
" 2 combined_id_archive 7514001 non-null object\n",
|
| 126 |
+
" 3 filename_manifest 7514001 non-null object\n",
|
| 127 |
+
" 4 md5_combined_manifest 7514001 non-null object\n",
|
| 128 |
+
" 5 combined_id_manifest_redownload 7514001 non-null object\n",
|
| 129 |
+
" 6 eol_content_id 7514001 non-null int64 \n",
|
| 130 |
+
" 7 eol_page_id 7514001 non-null int64 \n",
|
| 131 |
+
" 8 medium_source_url 7514001 non-null object\n",
|
| 132 |
+
" 9 eol_full_size_copy_url 7514001 non-null object\n",
|
| 133 |
+
" 10 license_name 7514001 non-null object\n",
|
| 134 |
+
" 11 copyright_owner 6860825 non-null object\n",
|
| 135 |
+
" 12 expected_image_filename 7514001 non-null object\n",
|
| 136 |
+
" 13 source_0706 7514001 non-null bool \n",
|
| 137 |
+
" 14 source_0726 7514001 non-null bool \n",
|
| 138 |
+
" 15 source_1206 7514001 non-null bool \n",
|
| 139 |
+
" 16 combined_id_full_manifest 7514001 non-null object\n",
|
| 140 |
+
"dtypes: bool(3), int64(2), object(12)\n",
|
| 141 |
+
"memory usage: 824.1+ MB\n"
|
| 142 |
+
]
|
| 143 |
+
}
|
| 144 |
+
],
|
| 145 |
+
"source": [
|
| 146 |
+
"links_manifest_cargo.info(show_counts=True)"
|
| 147 |
+
]
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"cell_type": "markdown",
|
| 151 |
+
"metadata": {},
|
| 152 |
+
"source": [
|
| 153 |
+
"These both have about 600-700 more entries than the earlier files."
|
| 154 |
+
]
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"cell_type": "code",
|
| 158 |
+
"execution_count": 6,
|
| 159 |
+
"metadata": {},
|
| 160 |
+
"outputs": [
|
| 161 |
+
{
|
| 162 |
+
"data": {
|
| 163 |
+
"text/html": [
|
| 164 |
+
"<div>\n",
|
| 165 |
+
"<style scoped>\n",
|
| 166 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 167 |
+
" vertical-align: middle;\n",
|
| 168 |
+
" }\n",
|
| 169 |
+
"\n",
|
| 170 |
+
" .dataframe tbody tr th {\n",
|
| 171 |
+
" vertical-align: top;\n",
|
| 172 |
+
" }\n",
|
| 173 |
+
"\n",
|
| 174 |
+
" .dataframe thead th {\n",
|
| 175 |
+
" text-align: right;\n",
|
| 176 |
+
" }\n",
|
| 177 |
+
"</style>\n",
|
| 178 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 179 |
+
" <thead>\n",
|
| 180 |
+
" <tr style=\"text-align: right;\">\n",
|
| 181 |
+
" <th></th>\n",
|
| 182 |
+
" <th>filename_archive</th>\n",
|
| 183 |
+
" <th>md5_archive</th>\n",
|
| 184 |
+
" <th>combined_id_archive</th>\n",
|
| 185 |
+
" <th>filename_manifest</th>\n",
|
| 186 |
+
" <th>md5_combined_manifest</th>\n",
|
| 187 |
+
" <th>combined_id_manifest_redownload</th>\n",
|
| 188 |
+
" <th>eol_content_id</th>\n",
|
| 189 |
+
" <th>eol_page_id</th>\n",
|
| 190 |
+
" <th>medium_source_url</th>\n",
|
| 191 |
+
" <th>eol_full_size_copy_url</th>\n",
|
| 192 |
+
" <th>license_name</th>\n",
|
| 193 |
+
" <th>copyright_owner</th>\n",
|
| 194 |
+
" <th>expected_image_filename</th>\n",
|
| 195 |
+
" <th>source_0706</th>\n",
|
| 196 |
+
" <th>source_0726</th>\n",
|
| 197 |
+
" <th>source_1206</th>\n",
|
| 198 |
+
" <th>combined_id_full_manifest</th>\n",
|
| 199 |
+
" </tr>\n",
|
| 200 |
+
" </thead>\n",
|
| 201 |
+
" <tbody>\n",
|
| 202 |
+
" </tbody>\n",
|
| 203 |
+
"</table>\n",
|
| 204 |
+
"</div>"
|
| 205 |
+
],
|
| 206 |
+
"text/plain": [
|
| 207 |
+
"Empty DataFrame\n",
|
| 208 |
+
"Columns: [filename_archive, md5_archive, combined_id_archive, filename_manifest, md5_combined_manifest, combined_id_manifest_redownload, eol_content_id, eol_page_id, medium_source_url, eol_full_size_copy_url, license_name, copyright_owner, expected_image_filename, source_0706, source_0726, source_1206, combined_id_full_manifest]\n",
|
| 209 |
+
"Index: []"
|
| 210 |
+
]
|
| 211 |
+
},
|
| 212 |
+
"execution_count": 6,
|
| 213 |
+
"metadata": {},
|
| 214 |
+
"output_type": "execute_result"
|
| 215 |
+
}
|
| 216 |
+
],
|
| 217 |
+
"source": [
|
| 218 |
+
"# These should be the same\n",
|
| 219 |
+
"links_manifest_cargo.loc[links_manifest_cargo[\"combined_id_manifest_redownload\"] != links_manifest_cargo[\"combined_id_full_manifest\"]]"
|
| 220 |
+
]
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"cell_type": "code",
|
| 224 |
+
"execution_count": 7,
|
| 225 |
+
"metadata": {},
|
| 226 |
+
"outputs": [
|
| 227 |
+
{
|
| 228 |
+
"name": "stdout",
|
| 229 |
+
"output_type": "stream",
|
| 230 |
+
"text": [
|
| 231 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 232 |
+
"Index: 822558 entries, 2 to 7513999\n",
|
| 233 |
+
"Data columns (total 17 columns):\n",
|
| 234 |
+
" # Column Non-Null Count Dtype \n",
|
| 235 |
+
"--- ------ -------------- ----- \n",
|
| 236 |
+
" 0 filename_archive 822558 non-null object\n",
|
| 237 |
+
" 1 md5_archive 822558 non-null object\n",
|
| 238 |
+
" 2 combined_id_archive 822558 non-null object\n",
|
| 239 |
+
" 3 filename_manifest 822558 non-null object\n",
|
| 240 |
+
" 4 md5_combined_manifest 822558 non-null object\n",
|
| 241 |
+
" 5 combined_id_manifest_redownload 822558 non-null object\n",
|
| 242 |
+
" 6 eol_content_id 822558 non-null int64 \n",
|
| 243 |
+
" 7 eol_page_id 822558 non-null int64 \n",
|
| 244 |
+
" 8 medium_source_url 822558 non-null object\n",
|
| 245 |
+
" 9 eol_full_size_copy_url 822558 non-null object\n",
|
| 246 |
+
" 10 license_name 822558 non-null object\n",
|
| 247 |
+
" 11 copyright_owner 797147 non-null object\n",
|
| 248 |
+
" 12 expected_image_filename 822558 non-null object\n",
|
| 249 |
+
" 13 source_0706 822558 non-null bool \n",
|
| 250 |
+
" 14 source_0726 822558 non-null bool \n",
|
| 251 |
+
" 15 source_1206 822558 non-null bool \n",
|
| 252 |
+
" 16 combined_id_full_manifest 822558 non-null object\n",
|
| 253 |
+
"dtypes: bool(3), int64(2), object(12)\n",
|
| 254 |
+
"memory usage: 96.5+ MB\n"
|
| 255 |
+
]
|
| 256 |
+
}
|
| 257 |
+
],
|
| 258 |
+
"source": [
|
| 259 |
+
"# archive has replaced cargo\n",
|
| 260 |
+
"# full manifest or manifest redownload to replace manifest checksums -- they are equal\n",
|
| 261 |
+
"links_mismatch = links_manifest_cargo.loc[links_manifest_cargo[\"combined_id_archive\"] != links_manifest_cargo[\"combined_id_full_manifest\"]]\n",
|
| 262 |
+
"links_mismatch.info(show_counts = True)"
|
| 263 |
+
]
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"cell_type": "markdown",
|
| 267 |
+
"metadata": {},
|
| 268 |
+
"source": [
|
| 269 |
+
"There are 42 more mismatched entries. Only 13 additional unique images (MD5s)."
|
| 270 |
+
]
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"cell_type": "code",
|
| 274 |
+
"execution_count": 9,
|
| 275 |
+
"metadata": {},
|
| 276 |
+
"outputs": [
|
| 277 |
+
{
|
| 278 |
+
"data": {
|
| 279 |
+
"text/plain": [
|
| 280 |
+
"md5_archive 624574\n",
|
| 281 |
+
"combined_id_full_manifest 712540\n",
|
| 282 |
+
"combined_id_archive 703446\n",
|
| 283 |
+
"dtype: int64"
|
| 284 |
+
]
|
| 285 |
+
},
|
| 286 |
+
"execution_count": 9,
|
| 287 |
+
"metadata": {},
|
| 288 |
+
"output_type": "execute_result"
|
| 289 |
+
}
|
| 290 |
+
],
|
| 291 |
+
"source": [
|
| 292 |
+
"links_mismatch[[\"md5_archive\", \"combined_id_full_manifest\", \"combined_id_archive\"]].nunique()"
|
| 293 |
+
]
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"cell_type": "code",
|
| 297 |
+
"execution_count": 10,
|
| 298 |
+
"metadata": {},
|
| 299 |
+
"outputs": [],
|
| 300 |
+
"source": [
|
| 301 |
+
"# This is archive manifest mismatch\n",
|
| 302 |
+
"links_mismatch.to_csv(\"../data/links_archive_manifest_IDmismatch.csv\", index = False)"
|
| 303 |
+
]
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"cell_type": "code",
|
| 307 |
+
"execution_count": 11,
|
| 308 |
+
"metadata": {},
|
| 309 |
+
"outputs": [],
|
| 310 |
+
"source": [
|
| 311 |
+
"catalog = pd.read_csv(TOL_FILEPATH + \"catalog.csv\", low_memory=False)"
|
| 312 |
+
]
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"cell_type": "code",
|
| 316 |
+
"execution_count": 12,
|
| 317 |
+
"metadata": {},
|
| 318 |
+
"outputs": [],
|
| 319 |
+
"source": [
|
| 320 |
+
"# remove train_small and all non-EOL entries\n",
|
| 321 |
+
"catalog = catalog.loc[catalog.split != \"train_small\"]\n",
|
| 322 |
+
"eol_catalog = catalog.loc[catalog.eol_content_id.notna()]"
|
| 323 |
+
]
|
| 324 |
+
},
|
| 325 |
+
{
|
| 326 |
+
"cell_type": "code",
|
| 327 |
+
"execution_count": 13,
|
| 328 |
+
"metadata": {},
|
| 329 |
+
"outputs": [
|
| 330 |
+
{
|
| 331 |
+
"data": {
|
| 332 |
+
"text/plain": [
|
| 333 |
+
"split 2\n",
|
| 334 |
+
"treeoflife_id 6250420\n",
|
| 335 |
+
"eol_content_id 6250420\n",
|
| 336 |
+
"eol_page_id 503589\n",
|
| 337 |
+
"dtype: int64"
|
| 338 |
+
]
|
| 339 |
+
},
|
| 340 |
+
"execution_count": 13,
|
| 341 |
+
"metadata": {},
|
| 342 |
+
"output_type": "execute_result"
|
| 343 |
+
}
|
| 344 |
+
],
|
| 345 |
+
"source": [
|
| 346 |
+
"eol_catalog[list(eol_catalog.columns)[:4]].nunique()"
|
| 347 |
+
]
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"cell_type": "code",
|
| 351 |
+
"execution_count": 14,
|
| 352 |
+
"metadata": {},
|
| 353 |
+
"outputs": [],
|
| 354 |
+
"source": [
|
| 355 |
+
"eol_cols = [col for col in list(eol_catalog.columns) if \"bioscan\" not in col and \"inat\" not in col]"
|
| 356 |
+
]
|
| 357 |
+
},
|
| 358 |
+
{
|
| 359 |
+
"cell_type": "code",
|
| 360 |
+
"execution_count": 15,
|
| 361 |
+
"metadata": {},
|
| 362 |
+
"outputs": [
|
| 363 |
+
{
|
| 364 |
+
"name": "stdout",
|
| 365 |
+
"output_type": "stream",
|
| 366 |
+
"text": [
|
| 367 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 368 |
+
"Index: 6250420 entries, 956715 to 11000930\n",
|
| 369 |
+
"Data columns (total 12 columns):\n",
|
| 370 |
+
" # Column Non-Null Count Dtype \n",
|
| 371 |
+
"--- ------ -------------- ----- \n",
|
| 372 |
+
" 0 split 6250420 non-null object \n",
|
| 373 |
+
" 1 treeoflife_id 6250420 non-null object \n",
|
| 374 |
+
" 2 eol_content_id 6250420 non-null float64\n",
|
| 375 |
+
" 3 eol_page_id 6250420 non-null float64\n",
|
| 376 |
+
" 4 kingdom 5989611 non-null object \n",
|
| 377 |
+
" 5 phylum 5991207 non-null object \n",
|
| 378 |
+
" 6 class 5971438 non-null object \n",
|
| 379 |
+
" 7 order 5965299 non-null object \n",
|
| 380 |
+
" 8 family 5948728 non-null object \n",
|
| 381 |
+
" 9 genus 5940313 non-null object \n",
|
| 382 |
+
" 10 species 5951613 non-null object \n",
|
| 383 |
+
" 11 common 6250420 non-null object \n",
|
| 384 |
+
"dtypes: float64(2), object(10)\n",
|
| 385 |
+
"memory usage: 619.9+ MB\n"
|
| 386 |
+
]
|
| 387 |
+
}
|
| 388 |
+
],
|
| 389 |
+
"source": [
|
| 390 |
+
"eol_catalog = eol_catalog[eol_cols]\n",
|
| 391 |
+
"eol_catalog.info(show_counts=True)"
|
| 392 |
+
]
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"cell_type": "markdown",
|
| 396 |
+
"metadata": {},
|
| 397 |
+
"source": [
|
| 398 |
+
"Must recast IDs as `int64`"
|
| 399 |
+
]
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"cell_type": "code",
|
| 403 |
+
"execution_count": 16,
|
| 404 |
+
"metadata": {},
|
| 405 |
+
"outputs": [
|
| 406 |
+
{
|
| 407 |
+
"name": "stdout",
|
| 408 |
+
"output_type": "stream",
|
| 409 |
+
"text": [
|
| 410 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 411 |
+
"Index: 6250420 entries, 956715 to 11000930\n",
|
| 412 |
+
"Data columns (total 4 columns):\n",
|
| 413 |
+
" # Column Dtype \n",
|
| 414 |
+
"--- ------ ----- \n",
|
| 415 |
+
" 0 split object\n",
|
| 416 |
+
" 1 treeoflife_id object\n",
|
| 417 |
+
" 2 eol_content_id int64 \n",
|
| 418 |
+
" 3 eol_page_id int64 \n",
|
| 419 |
+
"dtypes: int64(2), object(2)\n",
|
| 420 |
+
"memory usage: 238.4+ MB\n"
|
| 421 |
+
]
|
| 422 |
+
}
|
| 423 |
+
],
|
| 424 |
+
"source": [
|
| 425 |
+
"eol_catalog = eol_catalog.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 426 |
+
"eol_catalog[eol_cols[:4]].info()"
|
| 427 |
+
]
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"cell_type": "code",
|
| 431 |
+
"execution_count": 17,
|
| 432 |
+
"metadata": {
|
| 433 |
+
"lines_to_next_cell": 2
|
| 434 |
+
},
|
| 435 |
+
"outputs": [],
|
| 436 |
+
"source": [
|
| 437 |
+
"# make combined ID for catalog and add suffix to eol content and page IDs\n",
|
| 438 |
+
"eol_catalog['combined_id_catalog'] = eol_catalog['eol_content_id'].astype(str) + '_' + eol_catalog['eol_page_id'].astype(str)\n",
|
| 439 |
+
"eol_catalog.rename(columns={'eol_content_id': 'eol_content_id_catalog', 'eol_page_id': 'eol_page_id_catalog'}, inplace=True)"
|
| 440 |
+
]
|
| 441 |
+
},
|
| 442 |
+
{
|
| 443 |
+
"cell_type": "code",
|
| 444 |
+
"execution_count": 18,
|
| 445 |
+
"metadata": {},
|
| 446 |
+
"outputs": [
|
| 447 |
+
{
|
| 448 |
+
"data": {
|
| 449 |
+
"text/plain": [
|
| 450 |
+
"6219674"
|
| 451 |
+
]
|
| 452 |
+
},
|
| 453 |
+
"execution_count": 18,
|
| 454 |
+
"metadata": {},
|
| 455 |
+
"output_type": "execute_result"
|
| 456 |
+
}
|
| 457 |
+
],
|
| 458 |
+
"source": [
|
| 459 |
+
"matched_catalog_ids = list(links_inner.combined_id_catalog.unique())\n",
|
| 460 |
+
"len(matched_catalog_ids)"
|
| 461 |
+
]
|
| 462 |
+
},
|
| 463 |
+
{
|
| 464 |
+
"cell_type": "markdown",
|
| 465 |
+
"metadata": {},
|
| 466 |
+
"source": [
|
| 467 |
+
"Here we go, we got an additional 630 matched IDs!"
|
| 468 |
+
]
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"cell_type": "code",
|
| 472 |
+
"execution_count": 19,
|
| 473 |
+
"metadata": {},
|
| 474 |
+
"outputs": [
|
| 475 |
+
{
|
| 476 |
+
"data": {
|
| 477 |
+
"text/plain": [
|
| 478 |
+
"['29538374_65414274',\n",
|
| 479 |
+
" '27793900_888015',\n",
|
| 480 |
+
" '29121641_5618956',\n",
|
| 481 |
+
" '27596176_607817',\n",
|
| 482 |
+
" '20300703_267922']"
|
| 483 |
+
]
|
| 484 |
+
},
|
| 485 |
+
"execution_count": 19,
|
| 486 |
+
"metadata": {},
|
| 487 |
+
"output_type": "execute_result"
|
| 488 |
+
}
|
| 489 |
+
],
|
| 490 |
+
"source": [
|
| 491 |
+
"matched_catalog_ids[:5]"
|
| 492 |
+
]
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"cell_type": "markdown",
|
| 496 |
+
"metadata": {},
|
| 497 |
+
"source": [
|
| 498 |
+
"We still have about 30K unmatched (as shown below, it's down to 30,746 from 31,376), let's find those in the catalog and then we'll try to merge with our mismatched cargo & manifest."
|
| 499 |
+
]
|
| 500 |
+
},
|
| 501 |
+
{
|
| 502 |
+
"cell_type": "code",
|
| 503 |
+
"execution_count": 20,
|
| 504 |
+
"metadata": {},
|
| 505 |
+
"outputs": [
|
| 506 |
+
{
|
| 507 |
+
"data": {
|
| 508 |
+
"text/plain": [
|
| 509 |
+
"5842839 28875844_579175\n",
|
| 510 |
+
"7715090 21712402_702458\n",
|
| 511 |
+
"10112940 27938371_3091824\n",
|
| 512 |
+
"8606944 27597441_49820955\n",
|
| 513 |
+
"1247592 14852900_2896866\n",
|
| 514 |
+
"Name: combined_id_catalog, dtype: object"
|
| 515 |
+
]
|
| 516 |
+
},
|
| 517 |
+
"execution_count": 20,
|
| 518 |
+
"metadata": {},
|
| 519 |
+
"output_type": "execute_result"
|
| 520 |
+
}
|
| 521 |
+
],
|
| 522 |
+
"source": [
|
| 523 |
+
"eol_catalog['combined_id_catalog'].sample(5)"
|
| 524 |
+
]
|
| 525 |
+
},
|
| 526 |
+
{
|
| 527 |
+
"cell_type": "code",
|
| 528 |
+
"execution_count": 21,
|
| 529 |
+
"metadata": {},
|
| 530 |
+
"outputs": [
|
| 531 |
+
{
|
| 532 |
+
"name": "stdout",
|
| 533 |
+
"output_type": "stream",
|
| 534 |
+
"text": [
|
| 535 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 536 |
+
"Index: 30746 entries, 956874 to 10996978\n",
|
| 537 |
+
"Data columns (total 13 columns):\n",
|
| 538 |
+
" # Column Non-Null Count Dtype \n",
|
| 539 |
+
"--- ------ -------------- ----- \n",
|
| 540 |
+
" 0 split 30746 non-null object\n",
|
| 541 |
+
" 1 treeoflife_id 30746 non-null object\n",
|
| 542 |
+
" 2 eol_content_id_catalog 30746 non-null int64 \n",
|
| 543 |
+
" 3 eol_page_id_catalog 30746 non-null int64 \n",
|
| 544 |
+
" 4 kingdom 30573 non-null object\n",
|
| 545 |
+
" 5 phylum 30578 non-null object\n",
|
| 546 |
+
" 6 class 30153 non-null object\n",
|
| 547 |
+
" 7 order 30528 non-null object\n",
|
| 548 |
+
" 8 family 30294 non-null object\n",
|
| 549 |
+
" 9 genus 30192 non-null object\n",
|
| 550 |
+
" 10 species 29399 non-null object\n",
|
| 551 |
+
" 11 common 30746 non-null object\n",
|
| 552 |
+
" 12 combined_id_catalog 30746 non-null object\n",
|
| 553 |
+
"dtypes: int64(2), object(11)\n",
|
| 554 |
+
"memory usage: 3.3+ MB\n"
|
| 555 |
+
]
|
| 556 |
+
}
|
| 557 |
+
],
|
| 558 |
+
"source": [
|
| 559 |
+
"mismatched_catalog = eol_catalog.loc[~eol_catalog[\"combined_id_catalog\"].isin(matched_catalog_ids)]\n",
|
| 560 |
+
"mismatched_catalog.info(show_counts = True)"
|
| 561 |
+
]
|
| 562 |
+
},
|
| 563 |
+
{
|
| 564 |
+
"cell_type": "code",
|
| 565 |
+
"execution_count": 22,
|
| 566 |
+
"metadata": {},
|
| 567 |
+
"outputs": [
|
| 568 |
+
{
|
| 569 |
+
"data": {
|
| 570 |
+
"text/plain": [
|
| 571 |
+
"split 2\n",
|
| 572 |
+
"treeoflife_id 30746\n",
|
| 573 |
+
"eol_content_id_catalog 30746\n",
|
| 574 |
+
"eol_page_id_catalog 7042\n",
|
| 575 |
+
"kingdom 7\n",
|
| 576 |
+
"phylum 33\n",
|
| 577 |
+
"class 87\n",
|
| 578 |
+
"order 355\n",
|
| 579 |
+
"family 1165\n",
|
| 580 |
+
"genus 3503\n",
|
| 581 |
+
"species 5174\n",
|
| 582 |
+
"common 6884\n",
|
| 583 |
+
"combined_id_catalog 30746\n",
|
| 584 |
+
"dtype: int64"
|
| 585 |
+
]
|
| 586 |
+
},
|
| 587 |
+
"execution_count": 22,
|
| 588 |
+
"metadata": {},
|
| 589 |
+
"output_type": "execute_result"
|
| 590 |
+
}
|
| 591 |
+
],
|
| 592 |
+
"source": [
|
| 593 |
+
"mismatched_catalog.nunique()"
|
| 594 |
+
]
|
| 595 |
+
},
|
| 596 |
+
{
|
| 597 |
+
"cell_type": "markdown",
|
| 598 |
+
"metadata": {},
|
| 599 |
+
"source": [
|
| 600 |
+
"Seems one class got resolved (equals more orders and down)."
|
| 601 |
+
]
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"cell_type": "markdown",
|
| 605 |
+
"metadata": {},
|
| 606 |
+
"source": [
|
| 607 |
+
"## Merge with Mismatched CargoArchive-Manifest\n",
|
| 608 |
+
"\n",
|
| 609 |
+
"let's merge with `links_mismatch` to see if the mismatched archive and manifest combined IDs can be linked up."
|
| 610 |
+
]
|
| 611 |
+
},
|
| 612 |
+
{
|
| 613 |
+
"cell_type": "code",
|
| 614 |
+
"execution_count": 23,
|
| 615 |
+
"metadata": {},
|
| 616 |
+
"outputs": [
|
| 617 |
+
{
|
| 618 |
+
"name": "stdout",
|
| 619 |
+
"output_type": "stream",
|
| 620 |
+
"text": [
|
| 621 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 622 |
+
"RangeIndex: 0 entries\n",
|
| 623 |
+
"Data columns (total 30 columns):\n",
|
| 624 |
+
" # Column Non-Null Count Dtype \n",
|
| 625 |
+
"--- ------ -------------- ----- \n",
|
| 626 |
+
" 0 split 0 non-null object\n",
|
| 627 |
+
" 1 treeoflife_id 0 non-null object\n",
|
| 628 |
+
" 2 eol_content_id_catalog 0 non-null int64 \n",
|
| 629 |
+
" 3 eol_page_id_catalog 0 non-null int64 \n",
|
| 630 |
+
" 4 kingdom 0 non-null object\n",
|
| 631 |
+
" 5 phylum 0 non-null object\n",
|
| 632 |
+
" 6 class 0 non-null object\n",
|
| 633 |
+
" 7 order 0 non-null object\n",
|
| 634 |
+
" 8 family 0 non-null object\n",
|
| 635 |
+
" 9 genus 0 non-null object\n",
|
| 636 |
+
" 10 species 0 non-null object\n",
|
| 637 |
+
" 11 common 0 non-null object\n",
|
| 638 |
+
" 12 combined_id_catalog 0 non-null object\n",
|
| 639 |
+
" 13 filename_archive 0 non-null object\n",
|
| 640 |
+
" 14 md5_archive 0 non-null object\n",
|
| 641 |
+
" 15 combined_id_archive 0 non-null object\n",
|
| 642 |
+
" 16 filename_manifest 0 non-null object\n",
|
| 643 |
+
" 17 md5_combined_manifest 0 non-null object\n",
|
| 644 |
+
" 18 combined_id_manifest_redownload 0 non-null object\n",
|
| 645 |
+
" 19 eol_content_id 0 non-null int64 \n",
|
| 646 |
+
" 20 eol_page_id 0 non-null int64 \n",
|
| 647 |
+
" 21 medium_source_url 0 non-null object\n",
|
| 648 |
+
" 22 eol_full_size_copy_url 0 non-null object\n",
|
| 649 |
+
" 23 license_name 0 non-null object\n",
|
| 650 |
+
" 24 copyright_owner 0 non-null object\n",
|
| 651 |
+
" 25 expected_image_filename 0 non-null object\n",
|
| 652 |
+
" 26 source_0706 0 non-null bool \n",
|
| 653 |
+
" 27 source_0726 0 non-null bool \n",
|
| 654 |
+
" 28 source_1206 0 non-null bool \n",
|
| 655 |
+
" 29 combined_id_full_manifest 0 non-null object\n",
|
| 656 |
+
"dtypes: bool(3), int64(4), object(23)\n",
|
| 657 |
+
"memory usage: 132.0+ bytes\n"
|
| 658 |
+
]
|
| 659 |
+
}
|
| 660 |
+
],
|
| 661 |
+
"source": [
|
| 662 |
+
"# replace manifest checksums with full manifest as above\n",
|
| 663 |
+
"links_catalog_mismatch = pd.merge(mismatched_catalog,\n",
|
| 664 |
+
" links_mismatch,\n",
|
| 665 |
+
" left_on = \"combined_id_catalog\",\n",
|
| 666 |
+
" right_on = \"combined_id_full_manifest\",\n",
|
| 667 |
+
" how = \"inner\")\n",
|
| 668 |
+
"links_catalog_mismatch.info(show_counts = True)"
|
| 669 |
+
]
|
| 670 |
+
},
|
| 671 |
+
{
|
| 672 |
+
"cell_type": "markdown",
|
| 673 |
+
"metadata": {},
|
| 674 |
+
"source": [
|
| 675 |
+
"Now there's no gain from the mismatch file, but that was only 29 images, so we've captured them from the archive (plus more!)."
|
| 676 |
+
]
|
| 677 |
+
},
|
| 678 |
+
{
|
| 679 |
+
"cell_type": "code",
|
| 680 |
+
"execution_count": 24,
|
| 681 |
+
"metadata": {},
|
| 682 |
+
"outputs": [
|
| 683 |
+
{
|
| 684 |
+
"data": {
|
| 685 |
+
"text/plain": [
|
| 686 |
+
"2003559 15270321_240065\n",
|
| 687 |
+
"8751466 29485627_17806\n",
|
| 688 |
+
"4818957 27965287_35726\n",
|
| 689 |
+
"8697796 9483753_328724\n",
|
| 690 |
+
"1049389 9446784_5019858\n",
|
| 691 |
+
"8364678 9467133_2925218\n",
|
| 692 |
+
"5119903 28880812_10305215\n",
|
| 693 |
+
"Name: combined_id_catalog, dtype: object"
|
| 694 |
+
]
|
| 695 |
+
},
|
| 696 |
+
"execution_count": 24,
|
| 697 |
+
"metadata": {},
|
| 698 |
+
"output_type": "execute_result"
|
| 699 |
+
}
|
| 700 |
+
],
|
| 701 |
+
"source": [
|
| 702 |
+
"mismatched_catalog.combined_id_catalog.sample(7)"
|
| 703 |
+
]
|
| 704 |
+
},
|
| 705 |
+
{
|
| 706 |
+
"cell_type": "markdown",
|
| 707 |
+
"metadata": {},
|
| 708 |
+
"source": [
|
| 709 |
+
"These pages are reasonably full too: [5660435](https://eol.org/pages/5660435)."
|
| 710 |
+
]
|
| 711 |
+
},
|
| 712 |
+
{
|
| 713 |
+
"cell_type": "markdown",
|
| 714 |
+
"metadata": {},
|
| 715 |
+
"source": [
|
| 716 |
+
"### Final Catalog\n",
|
| 717 |
+
"\n",
|
| 718 |
+
"Our final EOL catalog is thus going to be the `treeoflife_id`s in `links_inner`.\n",
|
| 719 |
+
"\n",
|
| 720 |
+
"Finall question is just how does this look for our `train_small`?"
|
| 721 |
+
]
|
| 722 |
+
},
|
| 723 |
+
{
|
| 724 |
+
"cell_type": "code",
|
| 725 |
+
"execution_count": 34,
|
| 726 |
+
"metadata": {},
|
| 727 |
+
"outputs": [
|
| 728 |
+
{
|
| 729 |
+
"name": "stdout",
|
| 730 |
+
"output_type": "stream",
|
| 731 |
+
"text": [
|
| 732 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 733 |
+
"Index: 593764 entries, 0 to 918500\n",
|
| 734 |
+
"Data columns (total 12 columns):\n",
|
| 735 |
+
" # Column Non-Null Count Dtype \n",
|
| 736 |
+
"--- ------ -------------- ----- \n",
|
| 737 |
+
" 0 split 593764 non-null object \n",
|
| 738 |
+
" 1 treeoflife_id 593764 non-null object \n",
|
| 739 |
+
" 2 eol_content_id 593764 non-null float64\n",
|
| 740 |
+
" 3 eol_page_id 593764 non-null float64\n",
|
| 741 |
+
" 4 kingdom 569128 non-null object \n",
|
| 742 |
+
" 5 phylum 569285 non-null object \n",
|
| 743 |
+
" 6 class 567356 non-null object \n",
|
| 744 |
+
" 7 order 566839 non-null object \n",
|
| 745 |
+
" 8 family 565269 non-null object \n",
|
| 746 |
+
" 9 genus 564605 non-null object \n",
|
| 747 |
+
" 10 species 565399 non-null object \n",
|
| 748 |
+
" 11 common 593764 non-null object \n",
|
| 749 |
+
"dtypes: float64(2), object(10)\n",
|
| 750 |
+
"memory usage: 58.9+ MB\n"
|
| 751 |
+
]
|
| 752 |
+
}
|
| 753 |
+
],
|
| 754 |
+
"source": [
|
| 755 |
+
"cat_2 = pd.read_csv(TOL_FILEPATH + \"catalog.csv\", low_memory=False)\n",
|
| 756 |
+
"\n",
|
| 757 |
+
"# reduce to just train_small and all non-EOL entries\n",
|
| 758 |
+
"cat_2 = cat_2.loc[cat_2.split == \"train_small\"]\n",
|
| 759 |
+
"eol_cat_2 = cat_2.loc[cat_2.eol_content_id.notna()]\n",
|
| 760 |
+
"\n",
|
| 761 |
+
"eol_cat_2 = eol_cat_2[eol_cols]\n",
|
| 762 |
+
"eol_cat_2.info(show_counts=True)"
|
| 763 |
+
]
|
| 764 |
+
},
|
| 765 |
+
{
|
| 766 |
+
"cell_type": "markdown",
|
| 767 |
+
"metadata": {},
|
| 768 |
+
"source": [
|
| 769 |
+
"So `train_small` has 593,764 images from EOL. \n",
|
| 770 |
+
"\n",
|
| 771 |
+
"Let's recast IDs as ints to match up with `links_inner` and check we have info for all of them."
|
| 772 |
+
]
|
| 773 |
+
},
|
| 774 |
+
{
|
| 775 |
+
"cell_type": "code",
|
| 776 |
+
"execution_count": 35,
|
| 777 |
+
"metadata": {},
|
| 778 |
+
"outputs": [
|
| 779 |
+
{
|
| 780 |
+
"name": "stdout",
|
| 781 |
+
"output_type": "stream",
|
| 782 |
+
"text": [
|
| 783 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 784 |
+
"Index: 593764 entries, 0 to 918500\n",
|
| 785 |
+
"Data columns (total 4 columns):\n",
|
| 786 |
+
" # Column Non-Null Count Dtype \n",
|
| 787 |
+
"--- ------ -------------- ----- \n",
|
| 788 |
+
" 0 split 593764 non-null object\n",
|
| 789 |
+
" 1 treeoflife_id 593764 non-null object\n",
|
| 790 |
+
" 2 eol_content_id 593764 non-null int64 \n",
|
| 791 |
+
" 3 eol_page_id 593764 non-null int64 \n",
|
| 792 |
+
"dtypes: int64(2), object(2)\n",
|
| 793 |
+
"memory usage: 22.7+ MB\n"
|
| 794 |
+
]
|
| 795 |
+
}
|
| 796 |
+
],
|
| 797 |
+
"source": [
|
| 798 |
+
"eol_cat_2 = eol_cat_2.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 799 |
+
"eol_cat_2[eol_cols[:4]].info()"
|
| 800 |
+
]
|
| 801 |
+
},
|
| 802 |
+
{
|
| 803 |
+
"cell_type": "code",
|
| 804 |
+
"execution_count": 36,
|
| 805 |
+
"metadata": {},
|
| 806 |
+
"outputs": [],
|
| 807 |
+
"source": [
|
| 808 |
+
"# make combined ID for catalog and add suffix to eol content and page IDs\n",
|
| 809 |
+
"eol_cat_2['combined_id_catalog'] = eol_cat_2['eol_content_id'].astype(str) + '_' + eol_cat_2['eol_page_id'].astype(str)\n",
|
| 810 |
+
"eol_cat_2.rename(columns={'eol_content_id': 'eol_content_id_catalog', 'eol_page_id': 'eol_page_id_catalog'}, inplace=True)"
|
| 811 |
+
]
|
| 812 |
+
},
|
| 813 |
+
{
|
| 814 |
+
"cell_type": "code",
|
| 815 |
+
"execution_count": 40,
|
| 816 |
+
"metadata": {},
|
| 817 |
+
"outputs": [
|
| 818 |
+
{
|
| 819 |
+
"name": "stdout",
|
| 820 |
+
"output_type": "stream",
|
| 821 |
+
"text": [
|
| 822 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 823 |
+
"RangeIndex: 612614 entries, 0 to 612613\n",
|
| 824 |
+
"Data columns (total 25 columns):\n",
|
| 825 |
+
" # Column Non-Null Count Dtype \n",
|
| 826 |
+
"--- ------ -------------- ----- \n",
|
| 827 |
+
" 0 split 612614 non-null object\n",
|
| 828 |
+
" 1 treeoflife_id 612614 non-null object\n",
|
| 829 |
+
" 2 eol_content_id_catalog 612614 non-null int64 \n",
|
| 830 |
+
" 3 eol_page_id_catalog 612614 non-null int64 \n",
|
| 831 |
+
" 4 kingdom 584979 non-null object\n",
|
| 832 |
+
" 5 phylum 585140 non-null object\n",
|
| 833 |
+
" 6 class 583235 non-null object\n",
|
| 834 |
+
" 7 order 582668 non-null object\n",
|
| 835 |
+
" 8 family 581082 non-null object\n",
|
| 836 |
+
" 9 genus 580464 non-null object\n",
|
| 837 |
+
" 10 species 579943 non-null object\n",
|
| 838 |
+
" 11 common 612614 non-null object\n",
|
| 839 |
+
" 12 combined_id_catalog_x 612614 non-null object\n",
|
| 840 |
+
" 13 combined_id_catalog_y 612614 non-null object\n",
|
| 841 |
+
" 14 filename_manifest 612614 non-null object\n",
|
| 842 |
+
" 15 combined_id_manifest_redownload 612614 non-null object\n",
|
| 843 |
+
" 16 medium_source_url 612614 non-null object\n",
|
| 844 |
+
" 17 eol_full_size_copy_url 612614 non-null object\n",
|
| 845 |
+
" 18 license_name 612614 non-null object\n",
|
| 846 |
+
" 19 copyright_owner 554029 non-null object\n",
|
| 847 |
+
" 20 expected_image_filename 612614 non-null object\n",
|
| 848 |
+
" 21 source_0706 612614 non-null bool \n",
|
| 849 |
+
" 22 source_0726 612614 non-null bool \n",
|
| 850 |
+
" 23 source_1206 612614 non-null bool \n",
|
| 851 |
+
" 24 combined_id_full_manifest 612614 non-null object\n",
|
| 852 |
+
"dtypes: bool(3), int64(2), object(20)\n",
|
| 853 |
+
"memory usage: 104.6+ MB\n"
|
| 854 |
+
]
|
| 855 |
+
}
|
| 856 |
+
],
|
| 857 |
+
"source": [
|
| 858 |
+
"eol_ts_links = pd.merge(eol_cat_2,\n",
|
| 859 |
+
" links_inner[list(links_inner.columns)[18:]],\n",
|
| 860 |
+
" left_on = \"combined_id_catalog\",\n",
|
| 861 |
+
" right_on = \"combined_id_full_manifest\",\n",
|
| 862 |
+
" how = \"inner\")\n",
|
| 863 |
+
"eol_ts_links.info(show_counts = True)"
|
| 864 |
+
]
|
| 865 |
+
},
|
| 866 |
+
{
|
| 867 |
+
"cell_type": "code",
|
| 868 |
+
"execution_count": 41,
|
| 869 |
+
"metadata": {},
|
| 870 |
+
"outputs": [
|
| 871 |
+
{
|
| 872 |
+
"data": {
|
| 873 |
+
"text/plain": [
|
| 874 |
+
"590730"
|
| 875 |
+
]
|
| 876 |
+
},
|
| 877 |
+
"execution_count": 41,
|
| 878 |
+
"metadata": {},
|
| 879 |
+
"output_type": "execute_result"
|
| 880 |
+
}
|
| 881 |
+
],
|
| 882 |
+
"source": [
|
| 883 |
+
"eol_ts_links.treeoflife_id.nunique()"
|
| 884 |
+
]
|
| 885 |
+
},
|
| 886 |
+
{
|
| 887 |
+
"cell_type": "markdown",
|
| 888 |
+
"metadata": {},
|
| 889 |
+
"source": [
|
| 890 |
+
"So we are missing the metadata for 3,734 of these images."
|
| 891 |
+
]
|
| 892 |
+
},
|
| 893 |
+
{
|
| 894 |
+
"cell_type": "markdown",
|
| 895 |
+
"metadata": {},
|
| 896 |
+
"source": [
|
| 897 |
+
"## Check on Rare Species Catalog"
|
| 898 |
+
]
|
| 899 |
+
},
|
| 900 |
+
{
|
| 901 |
+
"cell_type": "code",
|
| 902 |
+
"execution_count": 25,
|
| 903 |
+
"metadata": {},
|
| 904 |
+
"outputs": [
|
| 905 |
+
{
|
| 906 |
+
"name": "stdout",
|
| 907 |
+
"output_type": "stream",
|
| 908 |
+
"text": [
|
| 909 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 910 |
+
"RangeIndex: 12000 entries, 0 to 11999\n",
|
| 911 |
+
"Data columns (total 11 columns):\n",
|
| 912 |
+
" # Column Non-Null Count Dtype \n",
|
| 913 |
+
"--- ------ -------------- ----- \n",
|
| 914 |
+
" 0 rarespecies_id 12000 non-null object\n",
|
| 915 |
+
" 1 eol_content_id 12000 non-null int64 \n",
|
| 916 |
+
" 2 eol_page_id 12000 non-null int64 \n",
|
| 917 |
+
" 3 kingdom 12000 non-null object\n",
|
| 918 |
+
" 4 phylum 12000 non-null object\n",
|
| 919 |
+
" 5 class 12000 non-null object\n",
|
| 920 |
+
" 6 order 12000 non-null object\n",
|
| 921 |
+
" 7 family 12000 non-null object\n",
|
| 922 |
+
" 8 genus 12000 non-null object\n",
|
| 923 |
+
" 9 species 12000 non-null object\n",
|
| 924 |
+
" 10 sciName 12000 non-null object\n",
|
| 925 |
+
"dtypes: int64(2), object(9)\n",
|
| 926 |
+
"memory usage: 1.0+ MB\n"
|
| 927 |
+
]
|
| 928 |
+
}
|
| 929 |
+
],
|
| 930 |
+
"source": [
|
| 931 |
+
"rs_catalog = pd.read_csv(\"../../rare_species/data/rarespecies-catalog.csv\",\n",
|
| 932 |
+
" low_memory=False,\n",
|
| 933 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 934 |
+
"rs_catalog.info(show_counts = True)"
|
| 935 |
+
]
|
| 936 |
+
},
|
| 937 |
+
{
|
| 938 |
+
"cell_type": "code",
|
| 939 |
+
"execution_count": 26,
|
| 940 |
+
"metadata": {},
|
| 941 |
+
"outputs": [],
|
| 942 |
+
"source": [
|
| 943 |
+
"rs_catalog[\"combined_id_rs\"] = rs_catalog[\"eol_content_id\"].astype(str) + \"_\" + rs_catalog[\"eol_page_id\"].astype(str)\n",
|
| 944 |
+
"rs_catalog.rename(columns={'eol_content_id': 'eol_content_id_rs', 'eol_page_id': 'eol_page_id_rs'}, inplace=True)"
|
| 945 |
+
]
|
| 946 |
+
},
|
| 947 |
+
{
|
| 948 |
+
"cell_type": "code",
|
| 949 |
+
"execution_count": 27,
|
| 950 |
+
"metadata": {},
|
| 951 |
+
"outputs": [
|
| 952 |
+
{
|
| 953 |
+
"name": "stdout",
|
| 954 |
+
"output_type": "stream",
|
| 955 |
+
"text": [
|
| 956 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 957 |
+
"RangeIndex: 12552 entries, 0 to 12551\n",
|
| 958 |
+
"Data columns (total 29 columns):\n",
|
| 959 |
+
" # Column Non-Null Count Dtype \n",
|
| 960 |
+
"--- ------ -------------- ----- \n",
|
| 961 |
+
" 0 rarespecies_id 12552 non-null object\n",
|
| 962 |
+
" 1 eol_content_id_rs 12552 non-null int64 \n",
|
| 963 |
+
" 2 eol_page_id_rs 12552 non-null int64 \n",
|
| 964 |
+
" 3 kingdom 12552 non-null object\n",
|
| 965 |
+
" 4 phylum 12552 non-null object\n",
|
| 966 |
+
" 5 class 12552 non-null object\n",
|
| 967 |
+
" 6 order 12552 non-null object\n",
|
| 968 |
+
" 7 family 12552 non-null object\n",
|
| 969 |
+
" 8 genus 12552 non-null object\n",
|
| 970 |
+
" 9 species 12552 non-null object\n",
|
| 971 |
+
" 10 sciName 12552 non-null object\n",
|
| 972 |
+
" 11 combined_id_rs 12552 non-null object\n",
|
| 973 |
+
" 12 filename_archive 12552 non-null object\n",
|
| 974 |
+
" 13 md5_archive 12552 non-null object\n",
|
| 975 |
+
" 14 combined_id_archive 12552 non-null object\n",
|
| 976 |
+
" 15 filename_manifest 12552 non-null object\n",
|
| 977 |
+
" 16 md5_combined_manifest 12552 non-null object\n",
|
| 978 |
+
" 17 combined_id_manifest_redownload 12552 non-null object\n",
|
| 979 |
+
" 18 eol_content_id 12552 non-null int64 \n",
|
| 980 |
+
" 19 eol_page_id 12552 non-null int64 \n",
|
| 981 |
+
" 20 medium_source_url 12552 non-null object\n",
|
| 982 |
+
" 21 eol_full_size_copy_url 12552 non-null object\n",
|
| 983 |
+
" 22 license_name 12552 non-null object\n",
|
| 984 |
+
" 23 copyright_owner 11171 non-null object\n",
|
| 985 |
+
" 24 expected_image_filename 12552 non-null object\n",
|
| 986 |
+
" 25 source_0706 12552 non-null bool \n",
|
| 987 |
+
" 26 source_0726 12552 non-null bool \n",
|
| 988 |
+
" 27 source_1206 12552 non-null bool \n",
|
| 989 |
+
" 28 combined_id_full_manifest 12552 non-null object\n",
|
| 990 |
+
"dtypes: bool(3), int64(4), object(22)\n",
|
| 991 |
+
"memory usage: 2.5+ MB\n"
|
| 992 |
+
]
|
| 993 |
+
}
|
| 994 |
+
],
|
| 995 |
+
"source": [
|
| 996 |
+
"rs_links = pd.merge(rs_catalog,\n",
|
| 997 |
+
" links_manifest_cargo,\n",
|
| 998 |
+
" left_on = \"combined_id_rs\",\n",
|
| 999 |
+
" right_on = \"combined_id_archive\", # looking at archive\n",
|
| 1000 |
+
" how = \"inner\")\n",
|
| 1001 |
+
"rs_links.info(show_counts = True)"
|
| 1002 |
+
]
|
| 1003 |
+
},
|
| 1004 |
+
{
|
| 1005 |
+
"cell_type": "code",
|
| 1006 |
+
"execution_count": 28,
|
| 1007 |
+
"metadata": {},
|
| 1008 |
+
"outputs": [
|
| 1009 |
+
{
|
| 1010 |
+
"data": {
|
| 1011 |
+
"text/plain": [
|
| 1012 |
+
"rarespecies_id 11826\n",
|
| 1013 |
+
"eol_content_id_rs 11826\n",
|
| 1014 |
+
"eol_page_id_rs 400\n",
|
| 1015 |
+
"kingdom 1\n",
|
| 1016 |
+
"phylum 5\n",
|
| 1017 |
+
"class 15\n",
|
| 1018 |
+
"order 85\n",
|
| 1019 |
+
"family 202\n",
|
| 1020 |
+
"genus 316\n",
|
| 1021 |
+
"species 385\n",
|
| 1022 |
+
"sciName 400\n",
|
| 1023 |
+
"combined_id_rs 11826\n",
|
| 1024 |
+
"filename_archive 11826\n",
|
| 1025 |
+
"md5_archive 11663\n",
|
| 1026 |
+
"combined_id_archive 11826\n",
|
| 1027 |
+
"filename_manifest 12221\n",
|
| 1028 |
+
"md5_combined_manifest 11663\n",
|
| 1029 |
+
"combined_id_manifest_redownload 12221\n",
|
| 1030 |
+
"eol_content_id 12221\n",
|
| 1031 |
+
"eol_page_id 447\n",
|
| 1032 |
+
"medium_source_url 12056\n",
|
| 1033 |
+
"eol_full_size_copy_url 12119\n",
|
| 1034 |
+
"license_name 15\n",
|
| 1035 |
+
"copyright_owner 3724\n",
|
| 1036 |
+
"expected_image_filename 12221\n",
|
| 1037 |
+
"source_0706 2\n",
|
| 1038 |
+
"source_0726 2\n",
|
| 1039 |
+
"source_1206 2\n",
|
| 1040 |
+
"combined_id_full_manifest 12221\n",
|
| 1041 |
+
"dtype: int64"
|
| 1042 |
+
]
|
| 1043 |
+
},
|
| 1044 |
+
"execution_count": 28,
|
| 1045 |
+
"metadata": {},
|
| 1046 |
+
"output_type": "execute_result"
|
| 1047 |
+
}
|
| 1048 |
+
],
|
| 1049 |
+
"source": [
|
| 1050 |
+
"rs_links.nunique()"
|
| 1051 |
+
]
|
| 1052 |
+
},
|
| 1053 |
+
{
|
| 1054 |
+
"cell_type": "markdown",
|
| 1055 |
+
"metadata": {},
|
| 1056 |
+
"source": [
|
| 1057 |
+
"Let's check the mismatched cargo/manifest entries for those last 174..."
|
| 1058 |
+
]
|
| 1059 |
+
},
|
| 1060 |
+
{
|
| 1061 |
+
"cell_type": "code",
|
| 1062 |
+
"execution_count": 29,
|
| 1063 |
+
"metadata": {},
|
| 1064 |
+
"outputs": [
|
| 1065 |
+
{
|
| 1066 |
+
"data": {
|
| 1067 |
+
"text/plain": [
|
| 1068 |
+
"11826"
|
| 1069 |
+
]
|
| 1070 |
+
},
|
| 1071 |
+
"execution_count": 29,
|
| 1072 |
+
"metadata": {},
|
| 1073 |
+
"output_type": "execute_result"
|
| 1074 |
+
}
|
| 1075 |
+
],
|
| 1076 |
+
"source": [
|
| 1077 |
+
"matched_rs_ids = list(rs_links.combined_id_rs.unique())\n",
|
| 1078 |
+
"len(matched_rs_ids)"
|
| 1079 |
+
]
|
| 1080 |
+
},
|
| 1081 |
+
{
|
| 1082 |
+
"cell_type": "code",
|
| 1083 |
+
"execution_count": 30,
|
| 1084 |
+
"metadata": {},
|
| 1085 |
+
"outputs": [
|
| 1086 |
+
{
|
| 1087 |
+
"data": {
|
| 1088 |
+
"text/plain": [
|
| 1089 |
+
"['22519448_914532',\n",
|
| 1090 |
+
" '28677580_1057176',\n",
|
| 1091 |
+
" '20714475_47047909',\n",
|
| 1092 |
+
" '29975068_45509269']"
|
| 1093 |
+
]
|
| 1094 |
+
},
|
| 1095 |
+
"execution_count": 30,
|
| 1096 |
+
"metadata": {},
|
| 1097 |
+
"output_type": "execute_result"
|
| 1098 |
+
}
|
| 1099 |
+
],
|
| 1100 |
+
"source": [
|
| 1101 |
+
"matched_rs_ids[:4]"
|
| 1102 |
+
]
|
| 1103 |
+
},
|
| 1104 |
+
{
|
| 1105 |
+
"cell_type": "code",
|
| 1106 |
+
"execution_count": 31,
|
| 1107 |
+
"metadata": {},
|
| 1108 |
+
"outputs": [
|
| 1109 |
+
{
|
| 1110 |
+
"data": {
|
| 1111 |
+
"text/plain": [
|
| 1112 |
+
"1473 29538601_46580048\n",
|
| 1113 |
+
"11127 29447084_1019571\n",
|
| 1114 |
+
"6578 20398296_328017\n",
|
| 1115 |
+
"11583 29772112_1049135\n",
|
| 1116 |
+
"Name: combined_id_rs, dtype: object"
|
| 1117 |
+
]
|
| 1118 |
+
},
|
| 1119 |
+
"execution_count": 31,
|
| 1120 |
+
"metadata": {},
|
| 1121 |
+
"output_type": "execute_result"
|
| 1122 |
+
}
|
| 1123 |
+
],
|
| 1124 |
+
"source": [
|
| 1125 |
+
"rs_catalog[\"combined_id_rs\"].sample(4)"
|
| 1126 |
+
]
|
| 1127 |
+
},
|
| 1128 |
+
{
|
| 1129 |
+
"cell_type": "code",
|
| 1130 |
+
"execution_count": 32,
|
| 1131 |
+
"metadata": {},
|
| 1132 |
+
"outputs": [
|
| 1133 |
+
{
|
| 1134 |
+
"name": "stdout",
|
| 1135 |
+
"output_type": "stream",
|
| 1136 |
+
"text": [
|
| 1137 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 1138 |
+
"Index: 174 entries, 163 to 11990\n",
|
| 1139 |
+
"Data columns (total 12 columns):\n",
|
| 1140 |
+
" # Column Non-Null Count Dtype \n",
|
| 1141 |
+
"--- ------ -------------- ----- \n",
|
| 1142 |
+
" 0 rarespecies_id 174 non-null object\n",
|
| 1143 |
+
" 1 eol_content_id_rs 174 non-null int64 \n",
|
| 1144 |
+
" 2 eol_page_id_rs 174 non-null int64 \n",
|
| 1145 |
+
" 3 kingdom 174 non-null object\n",
|
| 1146 |
+
" 4 phylum 174 non-null object\n",
|
| 1147 |
+
" 5 class 174 non-null object\n",
|
| 1148 |
+
" 6 order 174 non-null object\n",
|
| 1149 |
+
" 7 family 174 non-null object\n",
|
| 1150 |
+
" 8 genus 174 non-null object\n",
|
| 1151 |
+
" 9 species 174 non-null object\n",
|
| 1152 |
+
" 10 sciName 174 non-null object\n",
|
| 1153 |
+
" 11 combined_id_rs 174 non-null object\n",
|
| 1154 |
+
"dtypes: int64(2), object(10)\n",
|
| 1155 |
+
"memory usage: 17.7+ KB\n"
|
| 1156 |
+
]
|
| 1157 |
+
}
|
| 1158 |
+
],
|
| 1159 |
+
"source": [
|
| 1160 |
+
"mismatched_rs = rs_catalog.loc[~rs_catalog[\"combined_id_rs\"].isin(matched_rs_ids)]\n",
|
| 1161 |
+
"mismatched_rs.info(show_counts = True)"
|
| 1162 |
+
]
|
| 1163 |
+
},
|
| 1164 |
+
{
|
| 1165 |
+
"cell_type": "code",
|
| 1166 |
+
"execution_count": 33,
|
| 1167 |
+
"metadata": {},
|
| 1168 |
+
"outputs": [
|
| 1169 |
+
{
|
| 1170 |
+
"name": "stdout",
|
| 1171 |
+
"output_type": "stream",
|
| 1172 |
+
"text": [
|
| 1173 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 1174 |
+
"RangeIndex: 0 entries\n",
|
| 1175 |
+
"Data columns (total 29 columns):\n",
|
| 1176 |
+
" # Column Non-Null Count Dtype \n",
|
| 1177 |
+
"--- ------ -------------- ----- \n",
|
| 1178 |
+
" 0 rarespecies_id 0 non-null object\n",
|
| 1179 |
+
" 1 eol_content_id_rs 0 non-null int64 \n",
|
| 1180 |
+
" 2 eol_page_id_rs 0 non-null int64 \n",
|
| 1181 |
+
" 3 kingdom 0 non-null object\n",
|
| 1182 |
+
" 4 phylum 0 non-null object\n",
|
| 1183 |
+
" 5 class 0 non-null object\n",
|
| 1184 |
+
" 6 order 0 non-null object\n",
|
| 1185 |
+
" 7 family 0 non-null object\n",
|
| 1186 |
+
" 8 genus 0 non-null object\n",
|
| 1187 |
+
" 9 species 0 non-null object\n",
|
| 1188 |
+
" 10 sciName 0 non-null object\n",
|
| 1189 |
+
" 11 combined_id_rs 0 non-null object\n",
|
| 1190 |
+
" 12 filename_archive 0 non-null object\n",
|
| 1191 |
+
" 13 md5_archive 0 non-null object\n",
|
| 1192 |
+
" 14 combined_id_archive 0 non-null object\n",
|
| 1193 |
+
" 15 filename_manifest 0 non-null object\n",
|
| 1194 |
+
" 16 md5_combined_manifest 0 non-null object\n",
|
| 1195 |
+
" 17 combined_id_manifest_redownload 0 non-null object\n",
|
| 1196 |
+
" 18 eol_content_id 0 non-null int64 \n",
|
| 1197 |
+
" 19 eol_page_id 0 non-null int64 \n",
|
| 1198 |
+
" 20 medium_source_url 0 non-null object\n",
|
| 1199 |
+
" 21 eol_full_size_copy_url 0 non-null object\n",
|
| 1200 |
+
" 22 license_name 0 non-null object\n",
|
| 1201 |
+
" 23 copyright_owner 0 non-null object\n",
|
| 1202 |
+
" 24 expected_image_filename 0 non-null object\n",
|
| 1203 |
+
" 25 source_0706 0 non-null bool \n",
|
| 1204 |
+
" 26 source_0726 0 non-null bool \n",
|
| 1205 |
+
" 27 source_1206 0 non-null bool \n",
|
| 1206 |
+
" 28 combined_id_full_manifest 0 non-null object\n",
|
| 1207 |
+
"dtypes: bool(3), int64(4), object(22)\n",
|
| 1208 |
+
"memory usage: 132.0+ bytes\n"
|
| 1209 |
+
]
|
| 1210 |
+
}
|
| 1211 |
+
],
|
| 1212 |
+
"source": [
|
| 1213 |
+
"links_rs_mismatch = pd.merge(mismatched_rs,\n",
|
| 1214 |
+
" links_mismatch,\n",
|
| 1215 |
+
" left_on = \"combined_id_rs\",\n",
|
| 1216 |
+
" right_on = \"combined_id_full_manifest\",\n",
|
| 1217 |
+
" how = \"inner\")\n",
|
| 1218 |
+
"links_rs_mismatch.info(show_counts = True)"
|
| 1219 |
+
]
|
| 1220 |
+
},
|
| 1221 |
+
{
|
| 1222 |
+
"cell_type": "code",
|
| 1223 |
+
"execution_count": null,
|
| 1224 |
+
"metadata": {},
|
| 1225 |
+
"outputs": [],
|
| 1226 |
+
"source": []
|
| 1227 |
+
}
|
| 1228 |
+
],
|
| 1229 |
+
"metadata": {
|
| 1230 |
+
"jupytext": {
|
| 1231 |
+
"formats": "ipynb,py:percent"
|
| 1232 |
+
},
|
| 1233 |
+
"kernelspec": {
|
| 1234 |
+
"display_name": "tol",
|
| 1235 |
+
"language": "python",
|
| 1236 |
+
"name": "python3"
|
| 1237 |
+
},
|
| 1238 |
+
"language_info": {
|
| 1239 |
+
"codemirror_mode": {
|
| 1240 |
+
"name": "ipython",
|
| 1241 |
+
"version": 3
|
| 1242 |
+
},
|
| 1243 |
+
"file_extension": ".py",
|
| 1244 |
+
"mimetype": "text/x-python",
|
| 1245 |
+
"name": "python",
|
| 1246 |
+
"nbconvert_exporter": "python",
|
| 1247 |
+
"pygments_lexer": "ipython3",
|
| 1248 |
+
"version": "3.11.3"
|
| 1249 |
+
}
|
| 1250 |
+
},
|
| 1251 |
+
"nbformat": 4,
|
| 1252 |
+
"nbformat_minor": 2
|
| 1253 |
+
}
|
eol_realign/notebooks/links_align_reduced.py
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ---
|
| 2 |
+
# jupyter:
|
| 3 |
+
# jupytext:
|
| 4 |
+
# formats: ipynb,py:percent
|
| 5 |
+
# text_representation:
|
| 6 |
+
# extension: .py
|
| 7 |
+
# format_name: percent
|
| 8 |
+
# format_version: '1.3'
|
| 9 |
+
# jupytext_version: 1.16.0
|
| 10 |
+
# kernelspec:
|
| 11 |
+
# display_name: tol
|
| 12 |
+
# language: python
|
| 13 |
+
# name: python3
|
| 14 |
+
# ---
|
| 15 |
+
|
| 16 |
+
# %%
|
| 17 |
+
import pandas as pd
|
| 18 |
+
|
| 19 |
+
# %%
|
| 20 |
+
TOL_FILEPATH = "../../data/"
|
| 21 |
+
|
| 22 |
+
# %% [markdown]
|
| 23 |
+
# ### Read in Links CSV files
|
| 24 |
+
#
|
| 25 |
+
# Full cargo archives have some more content than the [original `links_inner` file](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_inner.csv) and the [original `links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv).
|
| 26 |
+
#
|
| 27 |
+
# From Matt:
|
| 28 |
+
# > It represents a series of inner merges:
|
| 29 |
+
# > 1. The list of images in the EOL cargo archive (used to create the webdatasets) with the EOL portion of `catalog.csv`
|
| 30 |
+
# > - Merged on a combined identifier of `eol_content_id` and `eol_page_id`.
|
| 31 |
+
# > Result from 1) with the list of images redownloaded from all 3 media manifests we touched around the original download time (identified [here](https://huggingface.co/datasets/imageomics/ToL-EDA/discussions/5#6584808d92eba5ad69b8379f)).
|
| 32 |
+
# > - Merged on MD5
|
| 33 |
+
# >
|
| 34 |
+
# > The result has 6,219,674 unique `treeoflife_id` entries and 6,146,917 unique `md5` entries. It has the combined `eol_content_id` and `eol_page_id` identifiers used at each stage:
|
| 35 |
+
# - `combined_id_catalog`: represents what's in the original catalog
|
| 36 |
+
# - `combined_id_manifest_full_manifest`: represents what's in the combined manifest from all 3 dates
|
| 37 |
+
# > It also has an indicator of which of the three media manifest files each entry was present in (one or more) in columns representing retreival date (eg., `source_0706`: indicates if it was present in the manifest retrieved on July 6, 2023). It also has the copyright owner and license information as contained in the media manifest files.
|
| 38 |
+
# >
|
| 39 |
+
# > Still needs to be run through the owner name finding code. ([owner_match](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/71ad5b49226a3a49634931005eeb340b3c96db13/scripts/match_owners.py) --note: this version uses inner merges, so will remove entries without media info. Probably should adjust this.)
|
| 40 |
+
#
|
| 41 |
+
# For reference on the numbers, there are 6,250,420 EOL images in TreeOfLife-10M (the catalog). Comparing with `links_inner` previously (from [`links_inner.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_inner.csv)) we were missing 31,376 images, 29 of which were identified in [`links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv).
|
| 42 |
+
|
| 43 |
+
# %%
|
| 44 |
+
links_inner = pd.read_csv("../data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv", low_memory=False)
|
| 45 |
+
links_manifest_cargo = pd.read_csv("../data/eol-cargo-archive_combined-manifest-checksums_links.csv", low_memory=False)
|
| 46 |
+
|
| 47 |
+
# %%
|
| 48 |
+
links_inner.info(show_counts=True)
|
| 49 |
+
|
| 50 |
+
# %%
|
| 51 |
+
links_manifest_cargo.info(show_counts=True)
|
| 52 |
+
|
| 53 |
+
# %% [markdown]
|
| 54 |
+
# These both have about 600-700 more entries than the earlier files.
|
| 55 |
+
|
| 56 |
+
# %%
|
| 57 |
+
# These should be the same
|
| 58 |
+
links_manifest_cargo.loc[links_manifest_cargo["combined_id_manifest_redownload"] != links_manifest_cargo["combined_id_full_manifest"]]
|
| 59 |
+
|
| 60 |
+
# %%
|
| 61 |
+
# archive has replaced cargo
|
| 62 |
+
# full manifest or manifest redownload to replace manifest checksums -- they are equal
|
| 63 |
+
links_mismatch = links_manifest_cargo.loc[links_manifest_cargo["combined_id_archive"] != links_manifest_cargo["combined_id_full_manifest"]]
|
| 64 |
+
links_mismatch.info(show_counts = True)
|
| 65 |
+
|
| 66 |
+
# %% [markdown]
|
| 67 |
+
# There are 42 more mismatched entries. Only 13 additional unique images (MD5s).
|
| 68 |
+
|
| 69 |
+
# %%
|
| 70 |
+
links_mismatch[["md5_archive", "combined_id_full_manifest", "combined_id_archive"]].nunique()
|
| 71 |
+
|
| 72 |
+
# %%
|
| 73 |
+
# This is archive manifest mismatch
|
| 74 |
+
links_mismatch.to_csv("../data/links_archive_manifest_IDmismatch.csv", index = False)
|
| 75 |
+
|
| 76 |
+
# %%
|
| 77 |
+
catalog = pd.read_csv(TOL_FILEPATH + "catalog.csv", low_memory=False)
|
| 78 |
+
|
| 79 |
+
# %%
|
| 80 |
+
# remove train_small and all non-EOL entries
|
| 81 |
+
catalog = catalog.loc[catalog.split != "train_small"]
|
| 82 |
+
eol_catalog = catalog.loc[catalog.eol_content_id.notna()]
|
| 83 |
+
|
| 84 |
+
# %%
|
| 85 |
+
eol_catalog[list(eol_catalog.columns)[:4]].nunique()
|
| 86 |
+
|
| 87 |
+
# %%
|
| 88 |
+
eol_cols = [col for col in list(eol_catalog.columns) if "bioscan" not in col and "inat" not in col]
|
| 89 |
+
|
| 90 |
+
# %%
|
| 91 |
+
eol_catalog = eol_catalog[eol_cols]
|
| 92 |
+
eol_catalog.info(show_counts=True)
|
| 93 |
+
|
| 94 |
+
# %% [markdown]
|
| 95 |
+
# Must recast IDs as `int64`
|
| 96 |
+
|
| 97 |
+
# %%
|
| 98 |
+
eol_catalog = eol_catalog.astype({"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 99 |
+
eol_catalog[eol_cols[:4]].info()
|
| 100 |
+
|
| 101 |
+
# %%
|
| 102 |
+
# make combined ID for catalog and add suffix to eol content and page IDs
|
| 103 |
+
eol_catalog['combined_id_catalog'] = eol_catalog['eol_content_id'].astype(str) + '_' + eol_catalog['eol_page_id'].astype(str)
|
| 104 |
+
eol_catalog.rename(columns={'eol_content_id': 'eol_content_id_catalog', 'eol_page_id': 'eol_page_id_catalog'}, inplace=True)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
# %%
|
| 108 |
+
matched_catalog_ids = list(links_inner.combined_id_catalog.unique())
|
| 109 |
+
len(matched_catalog_ids)
|
| 110 |
+
|
| 111 |
+
# %% [markdown]
|
| 112 |
+
# Here we go, we got an additional 630 matched IDs!
|
| 113 |
+
|
| 114 |
+
# %%
|
| 115 |
+
matched_catalog_ids[:5]
|
| 116 |
+
|
| 117 |
+
# %% [markdown]
|
| 118 |
+
# We still have about 30K unmatched (as shown below, it's down to 30,746 from 31,376), let's find those in the catalog and then we'll try to merge with our mismatched cargo & manifest.
|
| 119 |
+
|
| 120 |
+
# %%
|
| 121 |
+
eol_catalog['combined_id_catalog'].sample(5)
|
| 122 |
+
|
| 123 |
+
# %%
|
| 124 |
+
mismatched_catalog = eol_catalog.loc[~eol_catalog["combined_id_catalog"].isin(matched_catalog_ids)]
|
| 125 |
+
mismatched_catalog.info(show_counts = True)
|
| 126 |
+
|
| 127 |
+
# %%
|
| 128 |
+
mismatched_catalog.nunique()
|
| 129 |
+
|
| 130 |
+
# %% [markdown]
|
| 131 |
+
# Seems one class got resolved (equals more orders and down).
|
| 132 |
+
|
| 133 |
+
# %% [markdown]
|
| 134 |
+
# ## Merge with Mismatched CargoArchive-Manifest
|
| 135 |
+
#
|
| 136 |
+
# let's merge with `links_mismatch` to see if the mismatched archive and manifest combined IDs can be linked up.
|
| 137 |
+
|
| 138 |
+
# %%
|
| 139 |
+
# replace manifest checksums with full manifest as above
|
| 140 |
+
links_catalog_mismatch = pd.merge(mismatched_catalog,
|
| 141 |
+
links_mismatch,
|
| 142 |
+
left_on = "combined_id_catalog",
|
| 143 |
+
right_on = "combined_id_full_manifest",
|
| 144 |
+
how = "inner")
|
| 145 |
+
links_catalog_mismatch.info(show_counts = True)
|
| 146 |
+
|
| 147 |
+
# %% [markdown]
|
| 148 |
+
# Now there's no gain from the mismatch file, but that was only 29 images, so we've captured them from the archive (plus more!).
|
| 149 |
+
|
| 150 |
+
# %%
|
| 151 |
+
mismatched_catalog.combined_id_catalog.sample(7)
|
| 152 |
+
|
| 153 |
+
# %% [markdown]
|
| 154 |
+
# These pages are reasonably full too: [5660435](https://eol.org/pages/5660435).
|
| 155 |
+
|
| 156 |
+
# %% [markdown]
|
| 157 |
+
# ### Final Catalog
|
| 158 |
+
#
|
| 159 |
+
# Our final EOL catalog is thus going to be the `treeoflife_id`s in `links_inner`.
|
| 160 |
+
#
|
| 161 |
+
# Finall question is just how does this look for our `train_small`?
|
| 162 |
+
|
| 163 |
+
# %%
|
| 164 |
+
cat_2 = pd.read_csv(TOL_FILEPATH + "catalog.csv", low_memory=False)
|
| 165 |
+
|
| 166 |
+
# reduce to just train_small and all non-EOL entries
|
| 167 |
+
cat_2 = cat_2.loc[cat_2.split == "train_small"]
|
| 168 |
+
eol_cat_2 = cat_2.loc[cat_2.eol_content_id.notna()]
|
| 169 |
+
|
| 170 |
+
eol_cat_2 = eol_cat_2[eol_cols]
|
| 171 |
+
eol_cat_2.info(show_counts=True)
|
| 172 |
+
|
| 173 |
+
# %% [markdown]
|
| 174 |
+
# So `train_small` has 593,764 images from EOL.
|
| 175 |
+
#
|
| 176 |
+
# Let's recast IDs as ints to match up with `links_inner` and check we have info for all of them.
|
| 177 |
+
|
| 178 |
+
# %%
|
| 179 |
+
eol_cat_2 = eol_cat_2.astype({"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 180 |
+
eol_cat_2[eol_cols[:4]].info()
|
| 181 |
+
|
| 182 |
+
# %%
|
| 183 |
+
# make combined ID for catalog and add suffix to eol content and page IDs
|
| 184 |
+
eol_cat_2['combined_id_catalog'] = eol_cat_2['eol_content_id'].astype(str) + '_' + eol_cat_2['eol_page_id'].astype(str)
|
| 185 |
+
eol_cat_2.rename(columns={'eol_content_id': 'eol_content_id_catalog', 'eol_page_id': 'eol_page_id_catalog'}, inplace=True)
|
| 186 |
+
|
| 187 |
+
# %%
|
| 188 |
+
eol_ts_links = pd.merge(eol_cat_2,
|
| 189 |
+
links_inner[list(links_inner.columns)[18:]],
|
| 190 |
+
left_on = "combined_id_catalog",
|
| 191 |
+
right_on = "combined_id_full_manifest",
|
| 192 |
+
how = "inner")
|
| 193 |
+
eol_ts_links.info(show_counts = True)
|
| 194 |
+
|
| 195 |
+
# %%
|
| 196 |
+
eol_ts_links.treeoflife_id.nunique()
|
| 197 |
+
|
| 198 |
+
# %% [markdown]
|
| 199 |
+
# So we are missing the metadata for 3,734 of these images.
|
| 200 |
+
|
| 201 |
+
# %% [markdown]
|
| 202 |
+
# ## Check on Rare Species Catalog
|
| 203 |
+
|
| 204 |
+
# %%
|
| 205 |
+
rs_catalog = pd.read_csv("../../rare_species/data/rarespecies-catalog.csv",
|
| 206 |
+
low_memory=False,
|
| 207 |
+
dtype = {"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 208 |
+
rs_catalog.info(show_counts = True)
|
| 209 |
+
|
| 210 |
+
# %%
|
| 211 |
+
rs_catalog["combined_id_rs"] = rs_catalog["eol_content_id"].astype(str) + "_" + rs_catalog["eol_page_id"].astype(str)
|
| 212 |
+
rs_catalog.rename(columns={'eol_content_id': 'eol_content_id_rs', 'eol_page_id': 'eol_page_id_rs'}, inplace=True)
|
| 213 |
+
|
| 214 |
+
# %%
|
| 215 |
+
rs_links = pd.merge(rs_catalog,
|
| 216 |
+
links_manifest_cargo,
|
| 217 |
+
left_on = "combined_id_rs",
|
| 218 |
+
right_on = "combined_id_archive", # looking at archive
|
| 219 |
+
how = "inner")
|
| 220 |
+
rs_links.info(show_counts = True)
|
| 221 |
+
|
| 222 |
+
# %%
|
| 223 |
+
rs_links.nunique()
|
| 224 |
+
|
| 225 |
+
# %% [markdown]
|
| 226 |
+
# Let's check the mismatched cargo/manifest entries for those last 174...
|
| 227 |
+
|
| 228 |
+
# %%
|
| 229 |
+
matched_rs_ids = list(rs_links.combined_id_rs.unique())
|
| 230 |
+
len(matched_rs_ids)
|
| 231 |
+
|
| 232 |
+
# %%
|
| 233 |
+
matched_rs_ids[:4]
|
| 234 |
+
|
| 235 |
+
# %%
|
| 236 |
+
rs_catalog["combined_id_rs"].sample(4)
|
| 237 |
+
|
| 238 |
+
# %%
|
| 239 |
+
mismatched_rs = rs_catalog.loc[~rs_catalog["combined_id_rs"].isin(matched_rs_ids)]
|
| 240 |
+
mismatched_rs.info(show_counts = True)
|
| 241 |
+
|
| 242 |
+
# %%
|
| 243 |
+
links_rs_mismatch = pd.merge(mismatched_rs,
|
| 244 |
+
links_mismatch,
|
| 245 |
+
left_on = "combined_id_rs",
|
| 246 |
+
right_on = "combined_id_full_manifest",
|
| 247 |
+
how = "inner")
|
| 248 |
+
links_rs_mismatch.info(show_counts = True)
|
| 249 |
+
|
| 250 |
+
# %%
|
eol_realign/notebooks/links_rs_duplicates.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eol_realign/notebooks/links_rs_duplicates.py
ADDED
|
@@ -0,0 +1,536 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ---
|
| 2 |
+
# jupyter:
|
| 3 |
+
# jupytext:
|
| 4 |
+
# formats: ipynb,py:percent
|
| 5 |
+
# text_representation:
|
| 6 |
+
# extension: .py
|
| 7 |
+
# format_name: percent
|
| 8 |
+
# format_version: '1.3'
|
| 9 |
+
# jupytext_version: 1.16.0
|
| 10 |
+
# kernelspec:
|
| 11 |
+
# display_name: tol
|
| 12 |
+
# language: python
|
| 13 |
+
# name: python3
|
| 14 |
+
# ---
|
| 15 |
+
|
| 16 |
+
# %%
|
| 17 |
+
import pandas as pd
|
| 18 |
+
|
| 19 |
+
# %%
|
| 20 |
+
RS_FILEPATH = "../../rare_species/data/"
|
| 21 |
+
|
| 22 |
+
# %% [markdown]
|
| 23 |
+
# ### Read in Links CSV file
|
| 24 |
+
#
|
| 25 |
+
# Full cargo archive has some more content than the [original `links_manifest_cargo_on_md5.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/fa08e0f6692a013e4e4f5ca30dd0e8883c0021d8/eol_realign/data/links_manifest_cargo_on_md5.csv).
|
| 26 |
+
|
| 27 |
+
# %%
|
| 28 |
+
links_manifest_cargo = pd.read_csv("../data/eol-cargo-archive_combined-manifest-checksums_links.csv", low_memory=False)
|
| 29 |
+
|
| 30 |
+
# %%
|
| 31 |
+
links_manifest_cargo.info(show_counts=True)
|
| 32 |
+
|
| 33 |
+
# %% [markdown]
|
| 34 |
+
# ## Check on Rare Species Catalog
|
| 35 |
+
|
| 36 |
+
# %%
|
| 37 |
+
rs_catalog = pd.read_csv(RS_FILEPATH + "rarespecies-catalog.csv",
|
| 38 |
+
low_memory=False,
|
| 39 |
+
dtype = {"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 40 |
+
rs_catalog.info(show_counts = True)
|
| 41 |
+
|
| 42 |
+
# %%
|
| 43 |
+
rs_catalog["combined_id_rs"] = rs_catalog["eol_content_id"].astype(str) + "_" + rs_catalog["eol_page_id"].astype(str)
|
| 44 |
+
rs_catalog.rename(columns={'eol_content_id': 'eol_content_id_rs', 'eol_page_id': 'eol_page_id_rs'}, inplace=True)
|
| 45 |
+
|
| 46 |
+
# %%
|
| 47 |
+
rs_links = pd.merge(rs_catalog,
|
| 48 |
+
links_manifest_cargo,
|
| 49 |
+
left_on = "combined_id_rs",
|
| 50 |
+
right_on = "combined_id_archive", # merge on archive (replaced cargo)
|
| 51 |
+
how = "inner")
|
| 52 |
+
rs_links.info(show_counts = True)
|
| 53 |
+
|
| 54 |
+
# %%
|
| 55 |
+
rs_links.nunique()
|
| 56 |
+
|
| 57 |
+
# %% [markdown]
|
| 58 |
+
# All these numbers match our check with the cargo file.
|
| 59 |
+
|
| 60 |
+
# %% [markdown]
|
| 61 |
+
# Let's check the mismatched cargo/manifest entries for those last 174...
|
| 62 |
+
|
| 63 |
+
# %%
|
| 64 |
+
matched_rs_ids = list(rs_links.combined_id_rs.unique())
|
| 65 |
+
len(matched_rs_ids)
|
| 66 |
+
|
| 67 |
+
# %%
|
| 68 |
+
matched_rs_ids[:4]
|
| 69 |
+
|
| 70 |
+
# %%
|
| 71 |
+
rs_catalog["combined_id_rs"].sample(4)
|
| 72 |
+
|
| 73 |
+
# %%
|
| 74 |
+
mismatched_rs = rs_catalog.loc[~rs_catalog["combined_id_rs"].isin(matched_rs_ids)]
|
| 75 |
+
mismatched_rs.info(show_counts = True)
|
| 76 |
+
|
| 77 |
+
# %%
|
| 78 |
+
mismatched_rs.nunique()
|
| 79 |
+
|
| 80 |
+
# %%
|
| 81 |
+
mismatched_rs.sciName.value_counts()
|
| 82 |
+
|
| 83 |
+
# %%
|
| 84 |
+
big_sciNames_missing = ["Aonyx capensis",
|
| 85 |
+
"Zoogoneticus tequila",
|
| 86 |
+
"Sousa plumbea",
|
| 87 |
+
"Sylvilagus transitionalis",
|
| 88 |
+
"Scaphirhynchus albus",
|
| 89 |
+
"Raja asterias"]
|
| 90 |
+
|
| 91 |
+
# %%
|
| 92 |
+
pg_ids = []
|
| 93 |
+
for sciName in big_sciNames_missing:
|
| 94 |
+
pg_ids.append(rs_links.loc[rs_links["sciName"] == sciName, "eol_page_id"].unique())
|
| 95 |
+
pg_ids
|
| 96 |
+
|
| 97 |
+
# %%
|
| 98 |
+
num_images_by_pg = []
|
| 99 |
+
for pg_id in pg_ids:
|
| 100 |
+
num_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id[0]].shape[0]
|
| 101 |
+
num_images_by_pg.append((pg_id[0], num_images))
|
| 102 |
+
|
| 103 |
+
num_images_by_pg
|
| 104 |
+
|
| 105 |
+
# %% [markdown]
|
| 106 |
+
# The media for both of these last two is online: https://eol.org/pages/46560546/media, https://eol.org/pages/205909/media
|
| 107 |
+
|
| 108 |
+
# %%
|
| 109 |
+
big_mismatch = mismatched_rs.loc[mismatched_rs["sciName"].isin(big_sciNames_missing)]
|
| 110 |
+
big_mismatch.loc[big_mismatch["eol_page_id_rs"] == 205909].sample(5)
|
| 111 |
+
|
| 112 |
+
# %% [markdown]
|
| 113 |
+
# sampling some, they're "not in any collections": https://eol.org/media/30098484
|
| 114 |
+
|
| 115 |
+
# %%
|
| 116 |
+
big_mismatch.loc[big_mismatch["eol_page_id_rs"] == 46560546].sample(5)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
# %% [markdown]
|
| 120 |
+
# Meanwhile, these are giving me 404's: 27648160, 27648159, 27648164, 27648161, 27648166
|
| 121 |
+
|
| 122 |
+
# %%
|
| 123 |
+
def get_archive_content(combined_id):
|
| 124 |
+
return combined_id.split("_")[0]
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
# %%
|
| 128 |
+
links_manifest_cargo["eol_content_id_archive"] = links_manifest_cargo["combined_id_archive"].apply(get_archive_content)
|
| 129 |
+
|
| 130 |
+
# %%
|
| 131 |
+
# check if content IDs get recycled, content ID: 27648165, now online as: 30223317
|
| 132 |
+
# is eol_content_id the archive content ID?
|
| 133 |
+
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id_archive"] == 30223317]
|
| 134 |
+
|
| 135 |
+
# %%
|
| 136 |
+
# Is it in manifest?
|
| 137 |
+
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id"] == 30223317]
|
| 138 |
+
|
| 139 |
+
# %%
|
| 140 |
+
# to be sure we check manifest
|
| 141 |
+
links_manifest_cargo["eol_content_id_manifest"] = links_manifest_cargo["combined_id_full_manifest"].apply(get_archive_content)
|
| 142 |
+
|
| 143 |
+
links_manifest_cargo.loc[links_manifest_cargo["eol_content_id_manifest"] == 30223317]
|
| 144 |
+
|
| 145 |
+
# %% [markdown]
|
| 146 |
+
# This tracks with all eol content IDs being unique across manifest versions...would there be some other intermediate stage where it changed IDs _again_?!
|
| 147 |
+
|
| 148 |
+
# %%
|
| 149 |
+
# Save CSV of mismatched, they should be salvageable.
|
| 150 |
+
# We saw these images both online and in our cargo, just with different IDs
|
| 151 |
+
|
| 152 |
+
mismatched_rs.to_csv("../data/archive_mismatched_rarespecies.csv", index=False)
|
| 153 |
+
|
| 154 |
+
# %% [markdown]
|
| 155 |
+
# Most of our images for some of these species are missing their metadata. For the vast majority of the species, it's just 1 or 2 images.
|
| 156 |
+
|
| 157 |
+
# %% [markdown]
|
| 158 |
+
# ## Investigate Duplication
|
| 159 |
+
#
|
| 160 |
+
# Now I want some more info on those duplicated MD5's.
|
| 161 |
+
|
| 162 |
+
# %%
|
| 163 |
+
rs_links["md5_dupes"] = rs_links.duplicated(subset = "md5_archive", keep = "first")
|
| 164 |
+
rs_links["rs_id_dupes"] = rs_links.duplicated(subset = "rarespecies_id", keep = "first")
|
| 165 |
+
|
| 166 |
+
# %%
|
| 167 |
+
rs_links.loc[rs_links["rs_id_dupes"], "md5_dupes"].value_counts()
|
| 168 |
+
|
| 169 |
+
# %%
|
| 170 |
+
rs_links.loc[~rs_links["rs_id_dupes"], "md5_dupes"].value_counts()
|
| 171 |
+
|
| 172 |
+
# %% [markdown]
|
| 173 |
+
# Looks like we have 163 duplicated images in Rare Species...
|
| 174 |
+
|
| 175 |
+
# %%
|
| 176 |
+
rs = rs_links.loc[~rs_links["rs_id_dupes"]]
|
| 177 |
+
rs_dupes = rs.loc[rs["md5_dupes"]]
|
| 178 |
+
rs_dupes.nunique()
|
| 179 |
+
|
| 180 |
+
# %%
|
| 181 |
+
rs_dupes.sciName.value_counts()[:10]
|
| 182 |
+
|
| 183 |
+
# %% [markdown]
|
| 184 |
+
# We have 30 images per species, so we have about a fourth duplicated for some. Note that the counts here are the number of duplicate images, so the total number of times these particular images appear is N + 1.
|
| 185 |
+
|
| 186 |
+
# %% [markdown]
|
| 187 |
+
# Let's see how many images we have for each of these duplicated images.
|
| 188 |
+
|
| 189 |
+
# %%
|
| 190 |
+
rs_sci_dupe_pgs = list(rs_dupes.eol_page_id.unique())
|
| 191 |
+
rs_sci_dupe_pgs[:8]
|
| 192 |
+
|
| 193 |
+
# %%
|
| 194 |
+
num_images_by_pg = {}
|
| 195 |
+
#list with unique by md5
|
| 196 |
+
num_unique_imgs_by_pg = {}
|
| 197 |
+
for pg_id in rs_sci_dupe_pgs:
|
| 198 |
+
num_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id].shape[0]
|
| 199 |
+
num_images_by_pg[pg_id] = num_images
|
| 200 |
+
num_unique_images = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id"] == pg_id, "md5_archive"].nunique()
|
| 201 |
+
num_unique_imgs_by_pg[pg_id] = num_unique_images
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
# %%
|
| 205 |
+
len(num_images_by_pg)
|
| 206 |
+
|
| 207 |
+
# %%
|
| 208 |
+
for pg_id in num_unique_imgs_by_pg.keys():
|
| 209 |
+
if num_unique_imgs_by_pg[pg_id] < 30:
|
| 210 |
+
print(f"page ID {pg_id} has less than 30 unique images; it has {num_unique_imgs_by_pg[pg_id]} unique images")
|
| 211 |
+
|
| 212 |
+
# %% [markdown]
|
| 213 |
+
# https://eol.org/pages/485420/media has only 21 true images, since 3 are post-its.
|
| 214 |
+
|
| 215 |
+
# %%
|
| 216 |
+
rs_catalog.head()
|
| 217 |
+
|
| 218 |
+
# %%
|
| 219 |
+
rs_catalog["file_name"] = rs_catalog["combined_id_rs"].astype(str) + "_eol-full-size-copy.jpg"
|
| 220 |
+
rs_catalog["file_name"].sample(7)
|
| 221 |
+
|
| 222 |
+
# %%
|
| 223 |
+
# save filelist for easier fetching
|
| 224 |
+
#rs_catalog["file_name"].to_csv("../data/rs_file_list.txt", index = False)
|
| 225 |
+
# Not needed now
|
| 226 |
+
|
| 227 |
+
# %% [markdown]
|
| 228 |
+
# Save `rs_links` to file for adjusting Rare Species images for uniqueness.
|
| 229 |
+
|
| 230 |
+
# %%
|
| 231 |
+
rs_links.to_csv("../data/rs_links.csv", index = False)
|
| 232 |
+
|
| 233 |
+
# %% [markdown]
|
| 234 |
+
# ### Get MD5s of Images on Misalgined Pages
|
| 235 |
+
#
|
| 236 |
+
# Relevant background from Matt (with some notes for context here):
|
| 237 |
+
# - I have a CSV called `rarespecies_catalog_missing_manifest___archive.csv` with 174 entries (I double-checked that the entries in the "sciName" column all look good ... there are duplicates there, but all are valid Genus species binomials)
|
| 238 |
+
# - This file is from `archive_mismatched_rarespecies.csv` created above.
|
| 239 |
+
# - Filtered that for all the unique page IDs.
|
| 240 |
+
# - Downloaded a media manifest current as of today (March 11)
|
| 241 |
+
# - There are 1,929 entries in today's media manifest with page IDs from the filtered list mentioned above
|
| 242 |
+
# - Downloaded them to `eol_data_cleanup/data/rare_species_pageids/` (on OSC)
|
| 243 |
+
# - Logged downloads with errors (there were 2), so we have 1,927 JPGs
|
| 244 |
+
# - Took MD5s as well, which are in `eol_data_cleanup/data/rare_species_pageids/md5s.csv` (on OSC. Here this file is `rarespecies_missing_pages_md5s.csv`).
|
| 245 |
+
# - Has "filename" and "md5" columns, and filenames are `<contentID>_<pageID>_eol-full-size-copy.jpg`.
|
| 246 |
+
|
| 247 |
+
# %%
|
| 248 |
+
rs_mp = pd.read_csv("../data/rarespecies_missing_pages_md5s.csv", low_memory=False)
|
| 249 |
+
rs_mp.info(show_counts = True)
|
| 250 |
+
|
| 251 |
+
# %%
|
| 252 |
+
rs_mp.nunique()
|
| 253 |
+
|
| 254 |
+
# %% [markdown]
|
| 255 |
+
# So, how many of these are in the archive?
|
| 256 |
+
|
| 257 |
+
# %%
|
| 258 |
+
rs_mp_archive = pd.merge(rs_mp,
|
| 259 |
+
links_manifest_cargo[["filename_archive", "md5_archive", "filename_manifest"]],
|
| 260 |
+
left_on = "md5",
|
| 261 |
+
right_on = "md5_archive",
|
| 262 |
+
how = "inner")
|
| 263 |
+
rs_mp_archive.info(show_counts = True)
|
| 264 |
+
|
| 265 |
+
# %% [markdown]
|
| 266 |
+
# Interesting, most of these are actually in the archive.
|
| 267 |
+
|
| 268 |
+
# %%
|
| 269 |
+
rs_mp_archive.nunique()
|
| 270 |
+
|
| 271 |
+
# %% [markdown]
|
| 272 |
+
# Though it's mostly duplicates, so that makes sense with our earlier numbers.
|
| 273 |
+
|
| 274 |
+
# %%
|
| 275 |
+
rs_mp_archive.head(2)
|
| 276 |
+
|
| 277 |
+
# %% [markdown]
|
| 278 |
+
# ### Ensure uniqueness across available images
|
| 279 |
+
#
|
| 280 |
+
# Let's reduce the archive DataFrame down to just EOL page IDs from the Rare Species Catalog. We'll match on the archive page ID's (pulled from `filename_archive`). Then we need to merge `rs_mp` with `eol_media_manifest_2024-03-11.csv` to get the source info and concatenate the two DataFrames.
|
| 281 |
+
|
| 282 |
+
# %%
|
| 283 |
+
mp_manifest = pd.read_csv("../data/eol_media_manifest_2024-03-11.csv",
|
| 284 |
+
low_memory=False,
|
| 285 |
+
dtype = {"EOL content ID": "int64", "EOL page ID": "int64"})
|
| 286 |
+
mp_manifest.head(2)
|
| 287 |
+
|
| 288 |
+
# %% [markdown]
|
| 289 |
+
# Rename columns to match the archive file.
|
| 290 |
+
|
| 291 |
+
# %%
|
| 292 |
+
mp_manifest.rename(columns={"EOL content ID": "eol_content_id",
|
| 293 |
+
"EOL page ID": "eol_page_id",
|
| 294 |
+
"Medium Source URL": "medium_source_url",
|
| 295 |
+
"EOL Full-Size Copy URL": "eol_full_size_copy_url",
|
| 296 |
+
"License Name": "license_name",
|
| 297 |
+
"Copyright Owner": "copyright_owner"},
|
| 298 |
+
inplace = True)
|
| 299 |
+
mp_manifest["filename"] = mp_manifest["eol_content_id"].astype(str) + "_" + mp_manifest["eol_page_id"].astype(str) + "_eol-full-size-copy.jpg"
|
| 300 |
+
|
| 301 |
+
# %%
|
| 302 |
+
rs_mp_manifest = pd.merge(rs_mp,
|
| 303 |
+
mp_manifest,
|
| 304 |
+
on = "filename",
|
| 305 |
+
how = "inner")
|
| 306 |
+
rs_mp_manifest.nunique()
|
| 307 |
+
|
| 308 |
+
# %% [markdown]
|
| 309 |
+
# Good, everything merged as expected. Let's cut down the `links_manifest_cargo` DataFrame to just Rare Species pages, then we can concatenate these.
|
| 310 |
+
|
| 311 |
+
# %%
|
| 312 |
+
rs_pages = list(rs_catalog.eol_page_id_rs.unique())
|
| 313 |
+
len(rs_pages) # should be 400
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
# %%
|
| 317 |
+
def get_page_id(combined_id):
|
| 318 |
+
# want to use the archive combined ID to ensure match
|
| 319 |
+
# combined ID is eolContentID_eolPageID
|
| 320 |
+
return int(combined_id.split("_")[1])
|
| 321 |
+
|
| 322 |
+
links_manifest_cargo["eol_page_id_archive"] = links_manifest_cargo["combined_id_archive"].apply(get_page_id)
|
| 323 |
+
|
| 324 |
+
# %%
|
| 325 |
+
rs_links_cargo = links_manifest_cargo.loc[links_manifest_cargo["eol_page_id_archive"].isin(rs_pages)]
|
| 326 |
+
rs_links_cargo.nunique()
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
# %%
|
| 330 |
+
def get_content_id(combined_id):
|
| 331 |
+
# want to use the archive combined ID to ensure match
|
| 332 |
+
# combined ID is eolContentID_eolPageID
|
| 333 |
+
return int(combined_id.split("_")[0])
|
| 334 |
+
|
| 335 |
+
rs_links_cargo["eol_content_id_archive"] = rs_links_cargo["combined_id_archive"].apply(get_content_id)
|
| 336 |
+
rs_links_cargo.nunique()
|
| 337 |
+
|
| 338 |
+
# %%
|
| 339 |
+
cols_to_match = list(rs_links_cargo.columns)[:3] + ["eol_content_id_archive", "eol_page_id_archive"] + list(rs_mp_manifest.columns)[4:]
|
| 340 |
+
cols_to_match
|
| 341 |
+
|
| 342 |
+
# %%
|
| 343 |
+
rs_links_cargo = rs_links_cargo[cols_to_match]
|
| 344 |
+
rs_links_cargo.rename(columns={"filename_archive": "filename",
|
| 345 |
+
"md5_archive": "md5",
|
| 346 |
+
"combined_id_archive": "combined_id",
|
| 347 |
+
"eol_content_id_archive": "eol_content_id",
|
| 348 |
+
"eol_page_id_archive": "eol_page_id"},
|
| 349 |
+
inplace = True)
|
| 350 |
+
rs_links_cargo.columns
|
| 351 |
+
|
| 352 |
+
# %% [markdown]
|
| 353 |
+
# Now we just need to add `combined_id` to `rs_mp_manifest` and we'll be able to concatenate them.
|
| 354 |
+
|
| 355 |
+
# %%
|
| 356 |
+
rs_mp_manifest["combined_id"] = rs_mp_manifest["eol_content_id"].astype(str) + "_" + rs_mp_manifest["eol_page_id"].astype(str)
|
| 357 |
+
rs_mp_manifest.head()
|
| 358 |
+
|
| 359 |
+
# %%
|
| 360 |
+
rs_full_manifest = pd.concat([rs_links_cargo, rs_mp_manifest], ignore_index=True)
|
| 361 |
+
rs_full_manifest.nunique()
|
| 362 |
+
|
| 363 |
+
# %%
|
| 364 |
+
rs_full_manifest.shape
|
| 365 |
+
|
| 366 |
+
# %%
|
| 367 |
+
# does that match?
|
| 368 |
+
rs_links_cargo.shape[0] + rs_mp_manifest.shape[0]
|
| 369 |
+
|
| 370 |
+
# %% [markdown]
|
| 371 |
+
# Let's reduce this down to just unique MD5s. I think we'll have to regenerate rarespecies IDs, since we can't necessarily match all the ones we had before.
|
| 372 |
+
|
| 373 |
+
# %%
|
| 374 |
+
rs_full_manifest["duplicate_img"] = rs_full_manifest.duplicated(subset = "md5", keep = "first")
|
| 375 |
+
rs_full_manifest_unique = rs_full_manifest.loc[~rs_full_manifest["duplicate_img"]]
|
| 376 |
+
rs_full_manifest_unique.info(show_counts = True)
|
| 377 |
+
|
| 378 |
+
# %% [markdown]
|
| 379 |
+
# Now I need to reduce to just 30 images per page. Let's save this as a CSV first actually and then generate that in a new notebook. I can realign the labels based on the page IDs from the `rarespecies_catalog`, but I won't be able to properly rematch the `rarespecies_id`, so that will need to be regenerated...
|
| 380 |
+
#
|
| 381 |
+
# ### Run Owner match script on this before saving
|
| 382 |
+
#
|
| 383 |
+
# Let's match any missing owners where possible to make sure this is a full-info DataFrame before saving it to a CSV.
|
| 384 |
+
|
| 385 |
+
# %%
|
| 386 |
+
from tqdm import tqdm
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
# %%
|
| 390 |
+
def get_owners_titles(manifest, owners):
|
| 391 |
+
"""
|
| 392 |
+
Function to attach owner names and image titles to manifest entries in combined manifest.
|
| 393 |
+
Fills empty "copyright_owner" and "title" values with "not provided".
|
| 394 |
+
Parameters:
|
| 395 |
+
-----------
|
| 396 |
+
manifest - rs_full_manifest_unique
|
| 397 |
+
owners - DataFrame of July 26, 2023 media manifest entries that had missing owners, updated with their information.
|
| 398 |
+
Returns:
|
| 399 |
+
--------
|
| 400 |
+
manifest - Rare Species media manifest DataFrame with missing owners resolved to extent possible.
|
| 401 |
+
"""
|
| 402 |
+
missing_owners = [
|
| 403 |
+
comb_id
|
| 404 |
+
for comb_id in list(
|
| 405 |
+
manifest.loc[manifest["copyright_owner"].isna(), "combined_id"]
|
| 406 |
+
)
|
| 407 |
+
]
|
| 408 |
+
|
| 409 |
+
for comb_id in tqdm(missing_owners):
|
| 410 |
+
temp = owners.loc[owners.combined_id_owner == comb_id]
|
| 411 |
+
copyright_owner = str(temp["Copyright Owner"].values)
|
| 412 |
+
title = str(temp.title.values)
|
| 413 |
+
manifest.loc[manifest["combined_id"] == comb_id, "copyright_owner"] = copyright_owner
|
| 414 |
+
manifest.loc[manifest["combined_id"] == comb_id, "title"] = title
|
| 415 |
+
|
| 416 |
+
# Print counts of licenses for which owner info was not resolved
|
| 417 |
+
print(
|
| 418 |
+
"Licenses still missing Copyright Owners: \n",
|
| 419 |
+
manifest.loc[
|
| 420 |
+
manifest["copyright_owner"].isna(), "license_name"
|
| 421 |
+
].value_counts(),
|
| 422 |
+
)
|
| 423 |
+
|
| 424 |
+
# Fill null "copyright_owner" and "Title" values with "not provided"
|
| 425 |
+
manifest["copyright_owner"].fillna("not provided", inplace=True)
|
| 426 |
+
manifest["title"].fillna("not provided", inplace=True)
|
| 427 |
+
|
| 428 |
+
return manifest
|
| 429 |
+
|
| 430 |
+
|
| 431 |
+
def update_owners(manifest, owners):
|
| 432 |
+
"""
|
| 433 |
+
Function to fetch and attach the missing owner and title information to EOL catalog entries and save catalog-media file.
|
| 434 |
+
Parameters:
|
| 435 |
+
-----------
|
| 436 |
+
manifest - rs_full_manifest_unique.
|
| 437 |
+
owners - DataFrame of July 26, 2023 media manifest entries that had missing owners, updated with their information.
|
| 438 |
+
"""
|
| 439 |
+
# Need combined IDs for the owner match file
|
| 440 |
+
# EOL content & page IDs read in as int64
|
| 441 |
+
owners["combined_id_owner"] = owners["EOL content ID"].astype(str) + "_" + owners["EOL page ID"].astype(str)
|
| 442 |
+
|
| 443 |
+
updated_manifest = get_owners_titles(manifest, owners)
|
| 444 |
+
|
| 445 |
+
return updated_manifest
|
| 446 |
+
|
| 447 |
+
|
| 448 |
+
# %%
|
| 449 |
+
owner_df = pd.read_csv("../data/media_manifest_missing_licenses_jul26_owners.csv",
|
| 450 |
+
low_memory = False,
|
| 451 |
+
dtype={"EOL content ID": "int64", "EOL page ID": "int64"},)
|
| 452 |
+
|
| 453 |
+
|
| 454 |
+
# %%
|
| 455 |
+
complete_rs_manifest = update_owners(rs_full_manifest_unique, owner_df)
|
| 456 |
+
complete_rs_manifest.info(show_counts = True)
|
| 457 |
+
|
| 458 |
+
# %%
|
| 459 |
+
complete_rs_manifest.loc[complete_rs_manifest["copyright_owner"] == "not provided"].shape
|
| 460 |
+
|
| 461 |
+
# %%
|
| 462 |
+
complete_rs_manifest.sample(7)
|
| 463 |
+
|
| 464 |
+
# %%
|
| 465 |
+
complete_rs_manifest.loc[complete_rs_manifest["title"] == "not provided"].shape
|
| 466 |
+
|
| 467 |
+
# %% [markdown]
|
| 468 |
+
# Most don't have title, but they all have the copyright owner filled in. That's good!
|
| 469 |
+
|
| 470 |
+
# %%
|
| 471 |
+
cols = [col for col in list(complete_rs_manifest.columns) if col != "duplicate_img"]
|
| 472 |
+
complete_rs_manifest = complete_rs_manifest[cols]
|
| 473 |
+
complete_rs_manifest.head(2)
|
| 474 |
+
|
| 475 |
+
# %% [markdown]
|
| 476 |
+
# ### Add License URL Column for Completeness
|
| 477 |
+
|
| 478 |
+
# %%
|
| 479 |
+
CC_URL = "https://creativecommons.org/"
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
def get_license_url(license_version):
|
| 483 |
+
"""
|
| 484 |
+
Function to generate the appropriate Creative Commons URL for a given license.
|
| 485 |
+
All licenses in the media manifest are "cc-XX", a variation on "publicdomain", or "No known copyright restrictions".
|
| 486 |
+
|
| 487 |
+
Parameters:
|
| 488 |
+
-----------
|
| 489 |
+
license_version - String. License (eg., "cc-by-nc 3.0").
|
| 490 |
+
|
| 491 |
+
Returns:
|
| 492 |
+
--------
|
| 493 |
+
license_url - String. Creative Commons URL associated with the license_version.
|
| 494 |
+
|
| 495 |
+
"""
|
| 496 |
+
# First check for version number and isolate it
|
| 497 |
+
if "." in license_version:
|
| 498 |
+
version = license_version.split(sep="-")[-1]
|
| 499 |
+
license_name = license_version.split(sep="-" + version)[0]
|
| 500 |
+
else:
|
| 501 |
+
# No version specified, so default to latest version (4.0)
|
| 502 |
+
license_name = license_version
|
| 503 |
+
version = "4.0"
|
| 504 |
+
# Check which type of license
|
| 505 |
+
if license_name[:5] == "cc-by":
|
| 506 |
+
by_x = license_name.split(sep="cc-")[1]
|
| 507 |
+
license_url = CC_URL + "licenses/" + by_x + "/" + version
|
| 508 |
+
elif (license_name[:4] == "cc-0") or ("public" in license_name):
|
| 509 |
+
license_url = CC_URL + "publicdomain/zero/1.0"
|
| 510 |
+
else:
|
| 511 |
+
# "No known copyright restrictions"
|
| 512 |
+
license_url = None
|
| 513 |
+
return license_url
|
| 514 |
+
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
# %%
|
| 518 |
+
license_col = "license_name"
|
| 519 |
+
complete_rs_manifest["license_link"] = complete_rs_manifest[license_col].apply(get_license_url)
|
| 520 |
+
|
| 521 |
+
# %%
|
| 522 |
+
complete_rs_manifest.info(show_counts=True)
|
| 523 |
+
|
| 524 |
+
# %%
|
| 525 |
+
print(
|
| 526 |
+
"Licenses with no URL: \n",
|
| 527 |
+
complete_rs_manifest.loc[complete_rs_manifest["license_link"].isna(), license_col].value_counts(),
|
| 528 |
+
)
|
| 529 |
+
|
| 530 |
+
# %% [markdown]
|
| 531 |
+
# As expected, we're good to save this full Rare Species manifest now.
|
| 532 |
+
|
| 533 |
+
# %%
|
| 534 |
+
complete_rs_manifest.to_csv("../data/rarespecies_full_manifest.csv", index = False)
|
| 535 |
+
|
| 536 |
+
# %%
|
eol_realign/notebooks/re-gen_rs_catalog.ipynb
ADDED
|
@@ -0,0 +1,1527 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import pandas as pd"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 2,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"RS_FILEPATH = \"../../rare_species/data/\""
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "markdown",
|
| 23 |
+
"metadata": {},
|
| 24 |
+
"source": [
|
| 25 |
+
"### Read in Complete Rare Species Manifest"
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"cell_type": "code",
|
| 30 |
+
"execution_count": 3,
|
| 31 |
+
"metadata": {},
|
| 32 |
+
"outputs": [
|
| 33 |
+
{
|
| 34 |
+
"name": "stdout",
|
| 35 |
+
"output_type": "stream",
|
| 36 |
+
"text": [
|
| 37 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 38 |
+
"RangeIndex: 22146 entries, 0 to 22145\n",
|
| 39 |
+
"Data columns (total 11 columns):\n",
|
| 40 |
+
" # Column Non-Null Count Dtype \n",
|
| 41 |
+
"--- ------ -------------- ----- \n",
|
| 42 |
+
" 0 filename 22146 non-null object\n",
|
| 43 |
+
" 1 md5 22146 non-null object\n",
|
| 44 |
+
" 2 combined_id 22146 non-null object\n",
|
| 45 |
+
" 3 eol_content_id 22146 non-null int64 \n",
|
| 46 |
+
" 4 eol_page_id 22146 non-null int64 \n",
|
| 47 |
+
" 5 medium_source_url 22146 non-null object\n",
|
| 48 |
+
" 6 eol_full_size_copy_url 22146 non-null object\n",
|
| 49 |
+
" 7 license_name 22146 non-null object\n",
|
| 50 |
+
" 8 copyright_owner 22146 non-null object\n",
|
| 51 |
+
" 9 title 22146 non-null object\n",
|
| 52 |
+
" 10 license_link 22103 non-null object\n",
|
| 53 |
+
"dtypes: int64(2), object(9)\n",
|
| 54 |
+
"memory usage: 1.9+ MB\n"
|
| 55 |
+
]
|
| 56 |
+
}
|
| 57 |
+
],
|
| 58 |
+
"source": [
|
| 59 |
+
"rs_manifest = pd.read_csv(\"../data/rarespecies_full_manifest.csv\",\n",
|
| 60 |
+
" low_memory=False,\n",
|
| 61 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 62 |
+
"rs_manifest.info(show_counts = True)"
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"cell_type": "markdown",
|
| 67 |
+
"metadata": {},
|
| 68 |
+
"source": [
|
| 69 |
+
"## Read in Rare Species Catalog"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"cell_type": "markdown",
|
| 74 |
+
"metadata": {},
|
| 75 |
+
"source": [
|
| 76 |
+
"Note that the original [`rarespecies-catalog`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/rare_species/data/rarespecies-catalog.csv) generation was done in [`rare_species_make_catalog.ipynb`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/rare_species/notebooks/rare_species_make_catalog.ipynb). It used [`predicted-catalog.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/data/predicted-catalog.csv) to get the taxonomic information and align the [rare species cargo](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/rare_species/data/rarespecies.csv) appropriately. There were also checks that the unseen subset was indeed excluded from the [catalog](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/data/catalog.csv).\n",
|
| 77 |
+
"\n",
|
| 78 |
+
"We will use the [`rarespecies-catalog.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/5db838a9db980f4cf96027b326b06e0f42df0c65/rare_species/data/rarespecies-catalog.csv) generated in that notebook to align taxonomic information with the full rare species manifest (renamed locally to `rarespecies-catalog-orig.csv`)."
|
| 79 |
+
]
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"cell_type": "code",
|
| 83 |
+
"execution_count": 3,
|
| 84 |
+
"metadata": {},
|
| 85 |
+
"outputs": [
|
| 86 |
+
{
|
| 87 |
+
"name": "stdout",
|
| 88 |
+
"output_type": "stream",
|
| 89 |
+
"text": [
|
| 90 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 91 |
+
"RangeIndex: 12000 entries, 0 to 11999\n",
|
| 92 |
+
"Data columns (total 11 columns):\n",
|
| 93 |
+
" # Column Non-Null Count Dtype \n",
|
| 94 |
+
"--- ------ -------------- ----- \n",
|
| 95 |
+
" 0 rarespecies_id 12000 non-null object\n",
|
| 96 |
+
" 1 eol_content_id 12000 non-null int64 \n",
|
| 97 |
+
" 2 eol_page_id 12000 non-null int64 \n",
|
| 98 |
+
" 3 kingdom 12000 non-null object\n",
|
| 99 |
+
" 4 phylum 12000 non-null object\n",
|
| 100 |
+
" 5 class 12000 non-null object\n",
|
| 101 |
+
" 6 order 12000 non-null object\n",
|
| 102 |
+
" 7 family 12000 non-null object\n",
|
| 103 |
+
" 8 genus 12000 non-null object\n",
|
| 104 |
+
" 9 species 12000 non-null object\n",
|
| 105 |
+
" 10 sciName 12000 non-null object\n",
|
| 106 |
+
"dtypes: int64(2), object(9)\n",
|
| 107 |
+
"memory usage: 1.0+ MB\n"
|
| 108 |
+
]
|
| 109 |
+
}
|
| 110 |
+
],
|
| 111 |
+
"source": [
|
| 112 |
+
"rs_catalog = pd.read_csv(RS_FILEPATH + \"rarespecies-catalog-orig.csv\",\n",
|
| 113 |
+
" low_memory=False,\n",
|
| 114 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 115 |
+
"rs_catalog.info(show_counts = True)"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"cell_type": "markdown",
|
| 120 |
+
"metadata": {},
|
| 121 |
+
"source": [
|
| 122 |
+
"## Check Number of Images per Page"
|
| 123 |
+
]
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"cell_type": "code",
|
| 127 |
+
"execution_count": 5,
|
| 128 |
+
"metadata": {},
|
| 129 |
+
"outputs": [
|
| 130 |
+
{
|
| 131 |
+
"data": {
|
| 132 |
+
"text/plain": [
|
| 133 |
+
"22146"
|
| 134 |
+
]
|
| 135 |
+
},
|
| 136 |
+
"execution_count": 5,
|
| 137 |
+
"metadata": {},
|
| 138 |
+
"output_type": "execute_result"
|
| 139 |
+
}
|
| 140 |
+
],
|
| 141 |
+
"source": [
|
| 142 |
+
"rs_manifest[\"md5\"].nunique()"
|
| 143 |
+
]
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"cell_type": "markdown",
|
| 147 |
+
"metadata": {},
|
| 148 |
+
"source": [
|
| 149 |
+
"We should have at least 30 images per species, except for 5. Let's check the number of images for each species (all now included are unique, as demonstrated above)."
|
| 150 |
+
]
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"cell_type": "code",
|
| 154 |
+
"execution_count": 6,
|
| 155 |
+
"metadata": {
|
| 156 |
+
"lines_to_next_cell": 2
|
| 157 |
+
},
|
| 158 |
+
"outputs": [],
|
| 159 |
+
"source": [
|
| 160 |
+
"num_images_by_pg = {}\n",
|
| 161 |
+
"\n",
|
| 162 |
+
"for pg_id in list(rs_manifest.eol_page_id.unique()):\n",
|
| 163 |
+
" num_images = rs_manifest.loc[rs_manifest[\"eol_page_id\"] == pg_id].shape[0]\n",
|
| 164 |
+
" num_images_by_pg[pg_id] = num_images\n",
|
| 165 |
+
" rs_manifest.loc[rs_manifest[\"eol_page_id\"] == pg_id, \"num_images\"] = num_images\n"
|
| 166 |
+
]
|
| 167 |
+
},
|
| 168 |
+
{
|
| 169 |
+
"cell_type": "code",
|
| 170 |
+
"execution_count": 7,
|
| 171 |
+
"metadata": {},
|
| 172 |
+
"outputs": [
|
| 173 |
+
{
|
| 174 |
+
"data": {
|
| 175 |
+
"text/plain": [
|
| 176 |
+
"93"
|
| 177 |
+
]
|
| 178 |
+
},
|
| 179 |
+
"execution_count": 7,
|
| 180 |
+
"metadata": {},
|
| 181 |
+
"output_type": "execute_result"
|
| 182 |
+
}
|
| 183 |
+
],
|
| 184 |
+
"source": [
|
| 185 |
+
"rs_manifest.num_images.nunique()"
|
| 186 |
+
]
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"cell_type": "markdown",
|
| 190 |
+
"metadata": {},
|
| 191 |
+
"source": [
|
| 192 |
+
"There's a lot of variety in the number of images per page. We'll check again on the (expected 5) pages that have less than 30 images."
|
| 193 |
+
]
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"cell_type": "code",
|
| 197 |
+
"execution_count": 8,
|
| 198 |
+
"metadata": {},
|
| 199 |
+
"outputs": [
|
| 200 |
+
{
|
| 201 |
+
"name": "stdout",
|
| 202 |
+
"output_type": "stream",
|
| 203 |
+
"text": [
|
| 204 |
+
"page ID 485420 has less than 30 unique images; it has 24 unique images\n",
|
| 205 |
+
"page ID 914531 has less than 30 unique images; it has 29 unique images\n",
|
| 206 |
+
"page ID 791049 has less than 30 unique images; it has 27 unique images\n",
|
| 207 |
+
"page ID 205714 has less than 30 unique images; it has 29 unique images\n",
|
| 208 |
+
"page ID 1286909 has less than 30 unique images; it has 27 unique images\n"
|
| 209 |
+
]
|
| 210 |
+
}
|
| 211 |
+
],
|
| 212 |
+
"source": [
|
| 213 |
+
"for pg_id in num_images_by_pg.keys():\n",
|
| 214 |
+
" if num_images_by_pg[pg_id] < 30:\n",
|
| 215 |
+
" print(f\"page ID {pg_id} has less than 30 unique images; it has {num_images_by_pg[pg_id]} unique images\")"
|
| 216 |
+
]
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"cell_type": "markdown",
|
| 220 |
+
"metadata": {},
|
| 221 |
+
"source": [
|
| 222 |
+
"https://eol.org/pages/485420/media has only 21 true images, since 3 are post-its. These will need to be manually noted and removed."
|
| 223 |
+
]
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"cell_type": "markdown",
|
| 227 |
+
"metadata": {},
|
| 228 |
+
"source": [
|
| 229 |
+
"### Reduce to 30 Images per Page"
|
| 230 |
+
]
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"cell_type": "markdown",
|
| 234 |
+
"metadata": {},
|
| 235 |
+
"source": [
|
| 236 |
+
"Now we need to reduce to just 30 images per page. We can realign the labels based on the page IDs from the `rarespecies_catalog`, but I won't be able to properly rematch the `rarespecies_id`, so that will need to be regenerated..."
|
| 237 |
+
]
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"cell_type": "code",
|
| 241 |
+
"execution_count": 9,
|
| 242 |
+
"metadata": {},
|
| 243 |
+
"outputs": [
|
| 244 |
+
{
|
| 245 |
+
"data": {
|
| 246 |
+
"text/plain": [
|
| 247 |
+
"22146"
|
| 248 |
+
]
|
| 249 |
+
},
|
| 250 |
+
"execution_count": 9,
|
| 251 |
+
"metadata": {},
|
| 252 |
+
"output_type": "execute_result"
|
| 253 |
+
}
|
| 254 |
+
],
|
| 255 |
+
"source": [
|
| 256 |
+
"# Is filename unique? --yes, 22146 is number of images in the full rarespecies manifest\n",
|
| 257 |
+
"rs_manifest.filename.nunique()"
|
| 258 |
+
]
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"cell_type": "code",
|
| 262 |
+
"execution_count": 10,
|
| 263 |
+
"metadata": {},
|
| 264 |
+
"outputs": [
|
| 265 |
+
{
|
| 266 |
+
"data": {
|
| 267 |
+
"text/plain": [
|
| 268 |
+
"keep\n",
|
| 269 |
+
"yes 11986\n",
|
| 270 |
+
"Name: count, dtype: int64"
|
| 271 |
+
]
|
| 272 |
+
},
|
| 273 |
+
"execution_count": 10,
|
| 274 |
+
"metadata": {},
|
| 275 |
+
"output_type": "execute_result"
|
| 276 |
+
}
|
| 277 |
+
],
|
| 278 |
+
"source": [
|
| 279 |
+
"img_list_by_page = {}\n",
|
| 280 |
+
"\n",
|
| 281 |
+
"for page_id in list(rs_manifest.eol_page_id.unique()):\n",
|
| 282 |
+
" temp = rs_manifest.loc[rs_manifest.eol_page_id == page_id]\n",
|
| 283 |
+
" if temp.num_images.values[0] > 30:\n",
|
| 284 |
+
" imgs_to_keep = list(temp.filename.sample(30, random_state = 614)) #seed for reproducibility\n",
|
| 285 |
+
" else:\n",
|
| 286 |
+
" imgs_to_keep = list(temp.filename)\n",
|
| 287 |
+
"\n",
|
| 288 |
+
" rs_manifest.loc[rs_manifest[\"filename\"].isin(imgs_to_keep), \"keep\"] = \"yes\"\n",
|
| 289 |
+
" img_list_by_page[page_id] = imgs_to_keep\n",
|
| 290 |
+
"\n",
|
| 291 |
+
"rs_manifest[\"keep\"].value_counts()"
|
| 292 |
+
]
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"cell_type": "markdown",
|
| 296 |
+
"metadata": {},
|
| 297 |
+
"source": [
|
| 298 |
+
"That's 14 less than 12000 images, which matches with the number of images we'd be reduced by due to the 5 pages that have less than 30 images."
|
| 299 |
+
]
|
| 300 |
+
},
|
| 301 |
+
{
|
| 302 |
+
"cell_type": "code",
|
| 303 |
+
"execution_count": 11,
|
| 304 |
+
"metadata": {},
|
| 305 |
+
"outputs": [
|
| 306 |
+
{
|
| 307 |
+
"name": "stdout",
|
| 308 |
+
"output_type": "stream",
|
| 309 |
+
"text": [
|
| 310 |
+
"(11986, 13)\n"
|
| 311 |
+
]
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"data": {
|
| 315 |
+
"text/plain": [
|
| 316 |
+
"filename 11986\n",
|
| 317 |
+
"md5 11986\n",
|
| 318 |
+
"combined_id 11986\n",
|
| 319 |
+
"eol_content_id 11986\n",
|
| 320 |
+
"eol_page_id 400\n",
|
| 321 |
+
"medium_source_url 11986\n",
|
| 322 |
+
"eol_full_size_copy_url 11986\n",
|
| 323 |
+
"license_name 15\n",
|
| 324 |
+
"copyright_owner 4164\n",
|
| 325 |
+
"title 1290\n",
|
| 326 |
+
"license_link 10\n",
|
| 327 |
+
"num_images 93\n",
|
| 328 |
+
"keep 1\n",
|
| 329 |
+
"dtype: int64"
|
| 330 |
+
]
|
| 331 |
+
},
|
| 332 |
+
"execution_count": 11,
|
| 333 |
+
"metadata": {},
|
| 334 |
+
"output_type": "execute_result"
|
| 335 |
+
}
|
| 336 |
+
],
|
| 337 |
+
"source": [
|
| 338 |
+
"reduced_rs_manifest = rs_manifest.loc[rs_manifest[\"keep\"] == \"yes\"]\n",
|
| 339 |
+
"\n",
|
| 340 |
+
"print(reduced_rs_manifest.shape)\n",
|
| 341 |
+
"reduced_rs_manifest.nunique()"
|
| 342 |
+
]
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"cell_type": "code",
|
| 346 |
+
"execution_count": 12,
|
| 347 |
+
"metadata": {},
|
| 348 |
+
"outputs": [
|
| 349 |
+
{
|
| 350 |
+
"data": {
|
| 351 |
+
"text/plain": [
|
| 352 |
+
"num_images\n",
|
| 353 |
+
"30.0 11850\n",
|
| 354 |
+
"29.0 58\n",
|
| 355 |
+
"27.0 54\n",
|
| 356 |
+
"24.0 24\n",
|
| 357 |
+
"Name: count, dtype: int64"
|
| 358 |
+
]
|
| 359 |
+
},
|
| 360 |
+
"execution_count": 12,
|
| 361 |
+
"metadata": {},
|
| 362 |
+
"output_type": "execute_result"
|
| 363 |
+
}
|
| 364 |
+
],
|
| 365 |
+
"source": [
|
| 366 |
+
"for pg_id in list(reduced_rs_manifest.eol_page_id.unique()):\n",
|
| 367 |
+
" num_images = reduced_rs_manifest.loc[reduced_rs_manifest[\"eol_page_id\"] == pg_id].shape[0]\n",
|
| 368 |
+
" reduced_rs_manifest.loc[reduced_rs_manifest[\"eol_page_id\"] == pg_id, \"num_images\"] = num_images\n",
|
| 369 |
+
"\n",
|
| 370 |
+
"reduced_rs_manifest[\"num_images\"].value_counts()"
|
| 371 |
+
]
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"cell_type": "markdown",
|
| 375 |
+
"metadata": {},
|
| 376 |
+
"source": [
|
| 377 |
+
"One page has only 24, two have 27 & 29, the remaining 395 pages have 30.\n",
|
| 378 |
+
"\n",
|
| 379 |
+
"Let's track down those 3 post-it images on page 485420."
|
| 380 |
+
]
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"cell_type": "code",
|
| 384 |
+
"execution_count": 13,
|
| 385 |
+
"metadata": {},
|
| 386 |
+
"outputs": [
|
| 387 |
+
{
|
| 388 |
+
"name": "stdout",
|
| 389 |
+
"output_type": "stream",
|
| 390 |
+
"text": [
|
| 391 |
+
"https://eol.org/media/29856158\n",
|
| 392 |
+
"https://eol.org/media/28605134\n",
|
| 393 |
+
"https://eol.org/media/14677205\n",
|
| 394 |
+
"https://eol.org/media/28605135\n",
|
| 395 |
+
"https://eol.org/media/29856162\n",
|
| 396 |
+
"https://eol.org/media/29856156\n",
|
| 397 |
+
"https://eol.org/media/29856167\n",
|
| 398 |
+
"https://eol.org/media/29856165\n",
|
| 399 |
+
"https://eol.org/media/29856163\n",
|
| 400 |
+
"https://eol.org/media/29856157\n",
|
| 401 |
+
"https://eol.org/media/14677203\n",
|
| 402 |
+
"https://eol.org/media/29856159\n",
|
| 403 |
+
"https://eol.org/media/28605131\n",
|
| 404 |
+
"https://eol.org/media/29856155\n",
|
| 405 |
+
"https://eol.org/media/29856151\n",
|
| 406 |
+
"https://eol.org/media/29856161\n",
|
| 407 |
+
"https://eol.org/media/14677207\n",
|
| 408 |
+
"https://eol.org/media/29856150\n",
|
| 409 |
+
"https://eol.org/media/29856164\n",
|
| 410 |
+
"https://eol.org/media/14677204\n",
|
| 411 |
+
"https://eol.org/media/28605132\n",
|
| 412 |
+
"https://eol.org/media/28605133\n",
|
| 413 |
+
"https://eol.org/media/28605130\n",
|
| 414 |
+
"https://eol.org/media/29856166\n"
|
| 415 |
+
]
|
| 416 |
+
}
|
| 417 |
+
],
|
| 418 |
+
"source": [
|
| 419 |
+
"for content_id in list(reduced_rs_manifest.loc[reduced_rs_manifest[\"eol_page_id\"] == 485420, \"eol_content_id\"]):\n",
|
| 420 |
+
" print(f\"https://eol.org/media/{content_id}\")\n"
|
| 421 |
+
]
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
"cell_type": "markdown",
|
| 425 |
+
"metadata": {},
|
| 426 |
+
"source": [
|
| 427 |
+
"Post-it image EOL Content IDs (unique in this DataFrame):\n",
|
| 428 |
+
"- [28605134](https://eol.org/media/28605134)\n",
|
| 429 |
+
"- [29856159](https://eol.org/media/29856159)\n",
|
| 430 |
+
"- [29856164](https://eol.org/media/29856164)"
|
| 431 |
+
]
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"cell_type": "code",
|
| 435 |
+
"execution_count": 14,
|
| 436 |
+
"metadata": {},
|
| 437 |
+
"outputs": [
|
| 438 |
+
{
|
| 439 |
+
"name": "stdout",
|
| 440 |
+
"output_type": "stream",
|
| 441 |
+
"text": [
|
| 442 |
+
"(11983, 13)\n"
|
| 443 |
+
]
|
| 444 |
+
},
|
| 445 |
+
{
|
| 446 |
+
"data": {
|
| 447 |
+
"text/plain": [
|
| 448 |
+
"filename 11983\n",
|
| 449 |
+
"md5 11983\n",
|
| 450 |
+
"combined_id 11983\n",
|
| 451 |
+
"eol_content_id 11983\n",
|
| 452 |
+
"eol_page_id 400\n",
|
| 453 |
+
"medium_source_url 11983\n",
|
| 454 |
+
"eol_full_size_copy_url 11983\n",
|
| 455 |
+
"license_name 15\n",
|
| 456 |
+
"copyright_owner 4164\n",
|
| 457 |
+
"title 1290\n",
|
| 458 |
+
"license_link 10\n",
|
| 459 |
+
"num_images 4\n",
|
| 460 |
+
"keep 1\n",
|
| 461 |
+
"dtype: int64"
|
| 462 |
+
]
|
| 463 |
+
},
|
| 464 |
+
"execution_count": 14,
|
| 465 |
+
"metadata": {},
|
| 466 |
+
"output_type": "execute_result"
|
| 467 |
+
}
|
| 468 |
+
],
|
| 469 |
+
"source": [
|
| 470 |
+
"post_its = [28605134, 29856159, 29856164]\n",
|
| 471 |
+
"\n",
|
| 472 |
+
"rarespecies_manifest = reduced_rs_manifest.loc[~reduced_rs_manifest[\"eol_content_id\"].isin(post_its)]\n",
|
| 473 |
+
"print(rarespecies_manifest.shape)\n",
|
| 474 |
+
"rarespecies_manifest.nunique()"
|
| 475 |
+
]
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"cell_type": "markdown",
|
| 479 |
+
"metadata": {},
|
| 480 |
+
"source": [
|
| 481 |
+
"Remove extra columns"
|
| 482 |
+
]
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"cell_type": "code",
|
| 486 |
+
"execution_count": 15,
|
| 487 |
+
"metadata": {},
|
| 488 |
+
"outputs": [
|
| 489 |
+
{
|
| 490 |
+
"data": {
|
| 491 |
+
"text/plain": [
|
| 492 |
+
"Index(['filename', 'md5', 'combined_id', 'eol_content_id', 'eol_page_id',\n",
|
| 493 |
+
" 'medium_source_url', 'eol_full_size_copy_url', 'license_name',\n",
|
| 494 |
+
" 'copyright_owner', 'title', 'license_link'],\n",
|
| 495 |
+
" dtype='object')"
|
| 496 |
+
]
|
| 497 |
+
},
|
| 498 |
+
"execution_count": 15,
|
| 499 |
+
"metadata": {},
|
| 500 |
+
"output_type": "execute_result"
|
| 501 |
+
}
|
| 502 |
+
],
|
| 503 |
+
"source": [
|
| 504 |
+
"rarespecies_manifest = rarespecies_manifest[list(rarespecies_manifest.columns)[:-2]]\n",
|
| 505 |
+
"rarespecies_manifest.columns"
|
| 506 |
+
]
|
| 507 |
+
},
|
| 508 |
+
{
|
| 509 |
+
"cell_type": "markdown",
|
| 510 |
+
"metadata": {},
|
| 511 |
+
"source": [
|
| 512 |
+
"### Add `uuid` (new `rarespecies_id`)"
|
| 513 |
+
]
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"cell_type": "code",
|
| 517 |
+
"execution_count": 16,
|
| 518 |
+
"metadata": {},
|
| 519 |
+
"outputs": [],
|
| 520 |
+
"source": [
|
| 521 |
+
"import uuid"
|
| 522 |
+
]
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"cell_type": "code",
|
| 526 |
+
"execution_count": 17,
|
| 527 |
+
"metadata": {},
|
| 528 |
+
"outputs": [
|
| 529 |
+
{
|
| 530 |
+
"data": {
|
| 531 |
+
"text/plain": [
|
| 532 |
+
"11983"
|
| 533 |
+
]
|
| 534 |
+
},
|
| 535 |
+
"execution_count": 17,
|
| 536 |
+
"metadata": {},
|
| 537 |
+
"output_type": "execute_result"
|
| 538 |
+
}
|
| 539 |
+
],
|
| 540 |
+
"source": [
|
| 541 |
+
"rarespecies_manifest[\"rarespecies_id\"] = [uuid.uuid4() for i in range(rarespecies_manifest.shape[0])]\n",
|
| 542 |
+
"rarespecies_manifest.rarespecies_id.nunique()"
|
| 543 |
+
]
|
| 544 |
+
},
|
| 545 |
+
{
|
| 546 |
+
"cell_type": "markdown",
|
| 547 |
+
"metadata": {},
|
| 548 |
+
"source": [
|
| 549 |
+
"### Save Manifest with `uuid`s"
|
| 550 |
+
]
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"cell_type": "code",
|
| 554 |
+
"execution_count": 27,
|
| 555 |
+
"metadata": {},
|
| 556 |
+
"outputs": [],
|
| 557 |
+
"source": [
|
| 558 |
+
"rarespecies_manifest.to_csv(RS_FILEPATH + \"rarespecies_manifest.csv\", index = False)"
|
| 559 |
+
]
|
| 560 |
+
},
|
| 561 |
+
{
|
| 562 |
+
"cell_type": "markdown",
|
| 563 |
+
"metadata": {},
|
| 564 |
+
"source": [
|
| 565 |
+
"### Make and Save License File"
|
| 566 |
+
]
|
| 567 |
+
},
|
| 568 |
+
{
|
| 569 |
+
"cell_type": "code",
|
| 570 |
+
"execution_count": 28,
|
| 571 |
+
"metadata": {},
|
| 572 |
+
"outputs": [],
|
| 573 |
+
"source": [
|
| 574 |
+
"licesne_cols = [\"rarespecies_id\",\n",
|
| 575 |
+
" \"eol_content_id\",\n",
|
| 576 |
+
" \"eol_page_id\",\n",
|
| 577 |
+
" \"md5\",\n",
|
| 578 |
+
" \"medium_source_url\",\n",
|
| 579 |
+
" \"eol_full_size_copy_url\",\n",
|
| 580 |
+
" \"license_name\",\n",
|
| 581 |
+
" \"copyright_owner\",\n",
|
| 582 |
+
" \"license_link\",\n",
|
| 583 |
+
" \"title\"]\n",
|
| 584 |
+
"\n",
|
| 585 |
+
"licenses = rarespecies_manifest[licesne_cols]"
|
| 586 |
+
]
|
| 587 |
+
},
|
| 588 |
+
{
|
| 589 |
+
"cell_type": "code",
|
| 590 |
+
"execution_count": 29,
|
| 591 |
+
"metadata": {},
|
| 592 |
+
"outputs": [],
|
| 593 |
+
"source": [
|
| 594 |
+
"licenses.to_csv(RS_FILEPATH + \"licenses.csv\", index = False)"
|
| 595 |
+
]
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
"cell_type": "markdown",
|
| 599 |
+
"metadata": {},
|
| 600 |
+
"source": [
|
| 601 |
+
"## Make Rare Species Catalog\n",
|
| 602 |
+
"\n",
|
| 603 |
+
"Align taxonomic information to the IDs in the manifest.\n",
|
| 604 |
+
"\n",
|
| 605 |
+
"Pull manifest back in; something went weird with initial catalog generation."
|
| 606 |
+
]
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
"cell_type": "code",
|
| 610 |
+
"execution_count": 4,
|
| 611 |
+
"metadata": {},
|
| 612 |
+
"outputs": [
|
| 613 |
+
{
|
| 614 |
+
"name": "stdout",
|
| 615 |
+
"output_type": "stream",
|
| 616 |
+
"text": [
|
| 617 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 618 |
+
"RangeIndex: 11983 entries, 0 to 11982\n",
|
| 619 |
+
"Data columns (total 12 columns):\n",
|
| 620 |
+
" # Column Non-Null Count Dtype \n",
|
| 621 |
+
"--- ------ -------------- ----- \n",
|
| 622 |
+
" 0 filename 11983 non-null object\n",
|
| 623 |
+
" 1 md5 11983 non-null object\n",
|
| 624 |
+
" 2 combined_id 11983 non-null object\n",
|
| 625 |
+
" 3 eol_content_id 11983 non-null int64 \n",
|
| 626 |
+
" 4 eol_page_id 11983 non-null int64 \n",
|
| 627 |
+
" 5 medium_source_url 11983 non-null object\n",
|
| 628 |
+
" 6 eol_full_size_copy_url 11983 non-null object\n",
|
| 629 |
+
" 7 license_name 11983 non-null object\n",
|
| 630 |
+
" 8 copyright_owner 11983 non-null object\n",
|
| 631 |
+
" 9 title 11983 non-null object\n",
|
| 632 |
+
" 10 license_link 11957 non-null object\n",
|
| 633 |
+
" 11 rarespecies_id 11983 non-null object\n",
|
| 634 |
+
"dtypes: int64(2), object(10)\n",
|
| 635 |
+
"memory usage: 1.1+ MB\n"
|
| 636 |
+
]
|
| 637 |
+
}
|
| 638 |
+
],
|
| 639 |
+
"source": [
|
| 640 |
+
"rarespecies_manifest = pd.read_csv(RS_FILEPATH + \"rarespecies_manifest.csv\",\n",
|
| 641 |
+
" low_memory=False,\n",
|
| 642 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 643 |
+
"rarespecies_manifest.info(show_counts = True)"
|
| 644 |
+
]
|
| 645 |
+
},
|
| 646 |
+
{
|
| 647 |
+
"cell_type": "code",
|
| 648 |
+
"execution_count": 5,
|
| 649 |
+
"metadata": {},
|
| 650 |
+
"outputs": [],
|
| 651 |
+
"source": [
|
| 652 |
+
"id_cols = [\"rarespecies_id\", \"eol_content_id\", \"eol_page_id\"]"
|
| 653 |
+
]
|
| 654 |
+
},
|
| 655 |
+
{
|
| 656 |
+
"cell_type": "code",
|
| 657 |
+
"execution_count": 6,
|
| 658 |
+
"metadata": {},
|
| 659 |
+
"outputs": [
|
| 660 |
+
{
|
| 661 |
+
"data": {
|
| 662 |
+
"text/plain": [
|
| 663 |
+
"['eol_page_id',\n",
|
| 664 |
+
" 'kingdom',\n",
|
| 665 |
+
" 'phylum',\n",
|
| 666 |
+
" 'class',\n",
|
| 667 |
+
" 'order',\n",
|
| 668 |
+
" 'family',\n",
|
| 669 |
+
" 'genus',\n",
|
| 670 |
+
" 'species',\n",
|
| 671 |
+
" 'sciName']"
|
| 672 |
+
]
|
| 673 |
+
},
|
| 674 |
+
"execution_count": 6,
|
| 675 |
+
"metadata": {},
|
| 676 |
+
"output_type": "execute_result"
|
| 677 |
+
}
|
| 678 |
+
],
|
| 679 |
+
"source": [
|
| 680 |
+
"cat_cols = list(rs_catalog.columns)[2:]\n",
|
| 681 |
+
"cat_cols"
|
| 682 |
+
]
|
| 683 |
+
},
|
| 684 |
+
{
|
| 685 |
+
"cell_type": "code",
|
| 686 |
+
"execution_count": 8,
|
| 687 |
+
"metadata": {},
|
| 688 |
+
"outputs": [
|
| 689 |
+
{
|
| 690 |
+
"name": "stdout",
|
| 691 |
+
"output_type": "stream",
|
| 692 |
+
"text": [
|
| 693 |
+
"(359490, 11)\n"
|
| 694 |
+
]
|
| 695 |
+
},
|
| 696 |
+
{
|
| 697 |
+
"data": {
|
| 698 |
+
"text/plain": [
|
| 699 |
+
"rarespecies_id 11983\n",
|
| 700 |
+
"eol_content_id 11983\n",
|
| 701 |
+
"eol_page_id 400\n",
|
| 702 |
+
"kingdom 1\n",
|
| 703 |
+
"phylum 5\n",
|
| 704 |
+
"class 15\n",
|
| 705 |
+
"order 85\n",
|
| 706 |
+
"family 202\n",
|
| 707 |
+
"genus 316\n",
|
| 708 |
+
"species 385\n",
|
| 709 |
+
"sciName 400\n",
|
| 710 |
+
"dtype: int64"
|
| 711 |
+
]
|
| 712 |
+
},
|
| 713 |
+
"execution_count": 8,
|
| 714 |
+
"metadata": {},
|
| 715 |
+
"output_type": "execute_result"
|
| 716 |
+
}
|
| 717 |
+
],
|
| 718 |
+
"source": [
|
| 719 |
+
"updated_catalog = pd.merge(rarespecies_manifest[id_cols],\n",
|
| 720 |
+
" rs_catalog[cat_cols],\n",
|
| 721 |
+
" on = \"eol_page_id\",\n",
|
| 722 |
+
" how = \"left\")\n",
|
| 723 |
+
"\n",
|
| 724 |
+
"print(updated_catalog.shape)\n",
|
| 725 |
+
"updated_catalog.nunique()"
|
| 726 |
+
]
|
| 727 |
+
},
|
| 728 |
+
{
|
| 729 |
+
"cell_type": "markdown",
|
| 730 |
+
"metadata": {},
|
| 731 |
+
"source": [
|
| 732 |
+
"Uniqueness counts are as expected, but it duplicated entries for everything in the manifest (30 copies of everything since there are multiple matches per page). We need to use just the unique values."
|
| 733 |
+
]
|
| 734 |
+
},
|
| 735 |
+
{
|
| 736 |
+
"cell_type": "code",
|
| 737 |
+
"execution_count": 9,
|
| 738 |
+
"metadata": {},
|
| 739 |
+
"outputs": [
|
| 740 |
+
{
|
| 741 |
+
"data": {
|
| 742 |
+
"text/plain": [
|
| 743 |
+
"duplicate_species\n",
|
| 744 |
+
"True 11600\n",
|
| 745 |
+
"False 400\n",
|
| 746 |
+
"Name: count, dtype: int64"
|
| 747 |
+
]
|
| 748 |
+
},
|
| 749 |
+
"execution_count": 9,
|
| 750 |
+
"metadata": {},
|
| 751 |
+
"output_type": "execute_result"
|
| 752 |
+
}
|
| 753 |
+
],
|
| 754 |
+
"source": [
|
| 755 |
+
"rs_catalog[\"duplicate_species\"] = rs_catalog.duplicated(subset = cat_cols, keep = \"first\")\n",
|
| 756 |
+
"rs_catalog[\"duplicate_species\"].value_counts()"
|
| 757 |
+
]
|
| 758 |
+
},
|
| 759 |
+
{
|
| 760 |
+
"cell_type": "code",
|
| 761 |
+
"execution_count": 10,
|
| 762 |
+
"metadata": {},
|
| 763 |
+
"outputs": [
|
| 764 |
+
{
|
| 765 |
+
"data": {
|
| 766 |
+
"text/plain": [
|
| 767 |
+
"rarespecies_id 400\n",
|
| 768 |
+
"eol_content_id 400\n",
|
| 769 |
+
"eol_page_id 400\n",
|
| 770 |
+
"kingdom 1\n",
|
| 771 |
+
"phylum 5\n",
|
| 772 |
+
"class 15\n",
|
| 773 |
+
"order 85\n",
|
| 774 |
+
"family 202\n",
|
| 775 |
+
"genus 316\n",
|
| 776 |
+
"species 385\n",
|
| 777 |
+
"sciName 400\n",
|
| 778 |
+
"duplicate_species 1\n",
|
| 779 |
+
"dtype: int64"
|
| 780 |
+
]
|
| 781 |
+
},
|
| 782 |
+
"execution_count": 10,
|
| 783 |
+
"metadata": {},
|
| 784 |
+
"output_type": "execute_result"
|
| 785 |
+
}
|
| 786 |
+
],
|
| 787 |
+
"source": [
|
| 788 |
+
"unique_rs_catalog = rs_catalog.loc[~rs_catalog[\"duplicate_species\"]]\n",
|
| 789 |
+
"unique_rs_catalog.nunique()"
|
| 790 |
+
]
|
| 791 |
+
},
|
| 792 |
+
{
|
| 793 |
+
"cell_type": "markdown",
|
| 794 |
+
"metadata": {},
|
| 795 |
+
"source": [
|
| 796 |
+
"Now the merge shouldn't produce duplicates."
|
| 797 |
+
]
|
| 798 |
+
},
|
| 799 |
+
{
|
| 800 |
+
"cell_type": "code",
|
| 801 |
+
"execution_count": 11,
|
| 802 |
+
"metadata": {},
|
| 803 |
+
"outputs": [
|
| 804 |
+
{
|
| 805 |
+
"name": "stdout",
|
| 806 |
+
"output_type": "stream",
|
| 807 |
+
"text": [
|
| 808 |
+
"(11983, 11)\n"
|
| 809 |
+
]
|
| 810 |
+
},
|
| 811 |
+
{
|
| 812 |
+
"data": {
|
| 813 |
+
"text/plain": [
|
| 814 |
+
"rarespecies_id 11983\n",
|
| 815 |
+
"eol_content_id 11983\n",
|
| 816 |
+
"eol_page_id 400\n",
|
| 817 |
+
"kingdom 1\n",
|
| 818 |
+
"phylum 5\n",
|
| 819 |
+
"class 15\n",
|
| 820 |
+
"order 85\n",
|
| 821 |
+
"family 202\n",
|
| 822 |
+
"genus 316\n",
|
| 823 |
+
"species 385\n",
|
| 824 |
+
"sciName 400\n",
|
| 825 |
+
"dtype: int64"
|
| 826 |
+
]
|
| 827 |
+
},
|
| 828 |
+
"execution_count": 11,
|
| 829 |
+
"metadata": {},
|
| 830 |
+
"output_type": "execute_result"
|
| 831 |
+
}
|
| 832 |
+
],
|
| 833 |
+
"source": [
|
| 834 |
+
"updated_catalog = pd.merge(rarespecies_manifest[id_cols],\n",
|
| 835 |
+
" unique_rs_catalog[cat_cols],\n",
|
| 836 |
+
" on = \"eol_page_id\",\n",
|
| 837 |
+
" how = \"left\")\n",
|
| 838 |
+
"\n",
|
| 839 |
+
"print(updated_catalog.shape)\n",
|
| 840 |
+
"updated_catalog.nunique()"
|
| 841 |
+
]
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
"cell_type": "code",
|
| 845 |
+
"execution_count": 12,
|
| 846 |
+
"metadata": {},
|
| 847 |
+
"outputs": [
|
| 848 |
+
{
|
| 849 |
+
"data": {
|
| 850 |
+
"text/html": [
|
| 851 |
+
"<div>\n",
|
| 852 |
+
"<style scoped>\n",
|
| 853 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 854 |
+
" vertical-align: middle;\n",
|
| 855 |
+
" }\n",
|
| 856 |
+
"\n",
|
| 857 |
+
" .dataframe tbody tr th {\n",
|
| 858 |
+
" vertical-align: top;\n",
|
| 859 |
+
" }\n",
|
| 860 |
+
"\n",
|
| 861 |
+
" .dataframe thead th {\n",
|
| 862 |
+
" text-align: right;\n",
|
| 863 |
+
" }\n",
|
| 864 |
+
"</style>\n",
|
| 865 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 866 |
+
" <thead>\n",
|
| 867 |
+
" <tr style=\"text-align: right;\">\n",
|
| 868 |
+
" <th></th>\n",
|
| 869 |
+
" <th>rarespecies_id</th>\n",
|
| 870 |
+
" <th>eol_content_id</th>\n",
|
| 871 |
+
" <th>eol_page_id</th>\n",
|
| 872 |
+
" <th>kingdom</th>\n",
|
| 873 |
+
" <th>phylum</th>\n",
|
| 874 |
+
" <th>class</th>\n",
|
| 875 |
+
" <th>order</th>\n",
|
| 876 |
+
" <th>family</th>\n",
|
| 877 |
+
" <th>genus</th>\n",
|
| 878 |
+
" <th>species</th>\n",
|
| 879 |
+
" <th>sciName</th>\n",
|
| 880 |
+
" </tr>\n",
|
| 881 |
+
" </thead>\n",
|
| 882 |
+
" <tbody>\n",
|
| 883 |
+
" <tr>\n",
|
| 884 |
+
" <th>4462</th>\n",
|
| 885 |
+
" <td>0022b617-0f5a-48cf-93b4-b987bc0b28d5</td>\n",
|
| 886 |
+
" <td>30072827</td>\n",
|
| 887 |
+
" <td>323915</td>\n",
|
| 888 |
+
" <td>Animalia</td>\n",
|
| 889 |
+
" <td>Chordata</td>\n",
|
| 890 |
+
" <td>Mammalia</td>\n",
|
| 891 |
+
" <td>Primates</td>\n",
|
| 892 |
+
" <td>Atelidae</td>\n",
|
| 893 |
+
" <td>Alouatta</td>\n",
|
| 894 |
+
" <td>caraya</td>\n",
|
| 895 |
+
" <td>Alouatta caraya</td>\n",
|
| 896 |
+
" </tr>\n",
|
| 897 |
+
" <tr>\n",
|
| 898 |
+
" <th>3229</th>\n",
|
| 899 |
+
" <td>b14f5d3c-17d0-4d05-be0f-635c32813ecf</td>\n",
|
| 900 |
+
" <td>22894725</td>\n",
|
| 901 |
+
" <td>1047771</td>\n",
|
| 902 |
+
" <td>Animalia</td>\n",
|
| 903 |
+
" <td>Chordata</td>\n",
|
| 904 |
+
" <td>Aves</td>\n",
|
| 905 |
+
" <td>Passeriformes</td>\n",
|
| 906 |
+
" <td>Mimidae</td>\n",
|
| 907 |
+
" <td>Mimus</td>\n",
|
| 908 |
+
" <td>macdonaldi</td>\n",
|
| 909 |
+
" <td>Mimus macdonaldi</td>\n",
|
| 910 |
+
" </tr>\n",
|
| 911 |
+
" <tr>\n",
|
| 912 |
+
" <th>5172</th>\n",
|
| 913 |
+
" <td>a579040e-98dc-4249-b78a-94efe761770e</td>\n",
|
| 914 |
+
" <td>22191928</td>\n",
|
| 915 |
+
" <td>1038777</td>\n",
|
| 916 |
+
" <td>Animalia</td>\n",
|
| 917 |
+
" <td>Chordata</td>\n",
|
| 918 |
+
" <td>Mammalia</td>\n",
|
| 919 |
+
" <td>Artiodactyla</td>\n",
|
| 920 |
+
" <td>Bovidae</td>\n",
|
| 921 |
+
" <td>Procapra</td>\n",
|
| 922 |
+
" <td>picticaudata</td>\n",
|
| 923 |
+
" <td>Procapra picticaudata</td>\n",
|
| 924 |
+
" </tr>\n",
|
| 925 |
+
" <tr>\n",
|
| 926 |
+
" <th>9542</th>\n",
|
| 927 |
+
" <td>14b76c63-f4aa-4108-bcfe-04ad7004e615</td>\n",
|
| 928 |
+
" <td>29910658</td>\n",
|
| 929 |
+
" <td>47363970</td>\n",
|
| 930 |
+
" <td>Animalia</td>\n",
|
| 931 |
+
" <td>Chordata</td>\n",
|
| 932 |
+
" <td>Aves</td>\n",
|
| 933 |
+
" <td>Strigiformes</td>\n",
|
| 934 |
+
" <td>Strigidae</td>\n",
|
| 935 |
+
" <td>Athene</td>\n",
|
| 936 |
+
" <td>blewitti</td>\n",
|
| 937 |
+
" <td>Athene blewitti</td>\n",
|
| 938 |
+
" </tr>\n",
|
| 939 |
+
" <tr>\n",
|
| 940 |
+
" <th>7663</th>\n",
|
| 941 |
+
" <td>75e0f3c5-de1e-4e6a-96dc-1d3542dc5259</td>\n",
|
| 942 |
+
" <td>15263810</td>\n",
|
| 943 |
+
" <td>327865</td>\n",
|
| 944 |
+
" <td>Animalia</td>\n",
|
| 945 |
+
" <td>Chordata</td>\n",
|
| 946 |
+
" <td>Mammalia</td>\n",
|
| 947 |
+
" <td>Chiroptera</td>\n",
|
| 948 |
+
" <td>Phyllostomidae</td>\n",
|
| 949 |
+
" <td>Choeronycteris</td>\n",
|
| 950 |
+
" <td>mexicana</td>\n",
|
| 951 |
+
" <td>Choeronycteris mexicana</td>\n",
|
| 952 |
+
" </tr>\n",
|
| 953 |
+
" <tr>\n",
|
| 954 |
+
" <th>1418</th>\n",
|
| 955 |
+
" <td>9470b0d1-c077-41a1-ac09-6bfae0735e4f</td>\n",
|
| 956 |
+
" <td>2647</td>\n",
|
| 957 |
+
" <td>45511277</td>\n",
|
| 958 |
+
" <td>Animalia</td>\n",
|
| 959 |
+
" <td>Chordata</td>\n",
|
| 960 |
+
" <td>Aves</td>\n",
|
| 961 |
+
" <td>Procellariiformes</td>\n",
|
| 962 |
+
" <td>Diomedeidae</td>\n",
|
| 963 |
+
" <td>Thalassarche</td>\n",
|
| 964 |
+
" <td>chlororhynchos</td>\n",
|
| 965 |
+
" <td>Thalassarche chlororhynchos</td>\n",
|
| 966 |
+
" </tr>\n",
|
| 967 |
+
" <tr>\n",
|
| 968 |
+
" <th>8008</th>\n",
|
| 969 |
+
" <td>07ce200b-c168-4706-9328-5aa02eee1d73</td>\n",
|
| 970 |
+
" <td>22969028</td>\n",
|
| 971 |
+
" <td>1012078</td>\n",
|
| 972 |
+
" <td>Animalia</td>\n",
|
| 973 |
+
" <td>Chordata</td>\n",
|
| 974 |
+
" <td>Actinopterygii</td>\n",
|
| 975 |
+
" <td>Cyprinodontiformes</td>\n",
|
| 976 |
+
" <td>Cyprinodontidae</td>\n",
|
| 977 |
+
" <td>Cyprinodon</td>\n",
|
| 978 |
+
" <td>macularius</td>\n",
|
| 979 |
+
" <td>Cyprinodon macularius</td>\n",
|
| 980 |
+
" </tr>\n",
|
| 981 |
+
" <tr>\n",
|
| 982 |
+
" <th>6762</th>\n",
|
| 983 |
+
" <td>a1b441ac-8f72-41d5-9f89-db95ad09ea43</td>\n",
|
| 984 |
+
" <td>29679324</td>\n",
|
| 985 |
+
" <td>23668991</td>\n",
|
| 986 |
+
" <td>Animalia</td>\n",
|
| 987 |
+
" <td>Chordata</td>\n",
|
| 988 |
+
" <td>Reptilia</td>\n",
|
| 989 |
+
" <td>Squamata</td>\n",
|
| 990 |
+
" <td>Dactyloidae</td>\n",
|
| 991 |
+
" <td>Anolis</td>\n",
|
| 992 |
+
" <td>monteverde</td>\n",
|
| 993 |
+
" <td>Anolis monteverde</td>\n",
|
| 994 |
+
" </tr>\n",
|
| 995 |
+
" <tr>\n",
|
| 996 |
+
" <th>2846</th>\n",
|
| 997 |
+
" <td>cd86b9c7-31dc-4906-9536-05d64e2759ca</td>\n",
|
| 998 |
+
" <td>28928692</td>\n",
|
| 999 |
+
" <td>45518912</td>\n",
|
| 1000 |
+
" <td>Animalia</td>\n",
|
| 1001 |
+
" <td>Chordata</td>\n",
|
| 1002 |
+
" <td>Aves</td>\n",
|
| 1003 |
+
" <td>Charadriiformes</td>\n",
|
| 1004 |
+
" <td>Burhinidae</td>\n",
|
| 1005 |
+
" <td>Esacus</td>\n",
|
| 1006 |
+
" <td>recurvirostris</td>\n",
|
| 1007 |
+
" <td>Esacus recurvirostris</td>\n",
|
| 1008 |
+
" </tr>\n",
|
| 1009 |
+
" <tr>\n",
|
| 1010 |
+
" <th>8111</th>\n",
|
| 1011 |
+
" <td>91c6b4dd-c199-45fb-97cd-6bc9e4c7fbe6</td>\n",
|
| 1012 |
+
" <td>29033057</td>\n",
|
| 1013 |
+
" <td>963751</td>\n",
|
| 1014 |
+
" <td>Animalia</td>\n",
|
| 1015 |
+
" <td>Chordata</td>\n",
|
| 1016 |
+
" <td>Reptilia</td>\n",
|
| 1017 |
+
" <td>Squamata</td>\n",
|
| 1018 |
+
" <td>Iguanidae</td>\n",
|
| 1019 |
+
" <td>Ctenosaura</td>\n",
|
| 1020 |
+
" <td>bakeri</td>\n",
|
| 1021 |
+
" <td>Ctenosaura bakeri</td>\n",
|
| 1022 |
+
" </tr>\n",
|
| 1023 |
+
" </tbody>\n",
|
| 1024 |
+
"</table>\n",
|
| 1025 |
+
"</div>"
|
| 1026 |
+
],
|
| 1027 |
+
"text/plain": [
|
| 1028 |
+
" rarespecies_id eol_content_id eol_page_id \\\n",
|
| 1029 |
+
"4462 0022b617-0f5a-48cf-93b4-b987bc0b28d5 30072827 323915 \n",
|
| 1030 |
+
"3229 b14f5d3c-17d0-4d05-be0f-635c32813ecf 22894725 1047771 \n",
|
| 1031 |
+
"5172 a579040e-98dc-4249-b78a-94efe761770e 22191928 1038777 \n",
|
| 1032 |
+
"9542 14b76c63-f4aa-4108-bcfe-04ad7004e615 29910658 47363970 \n",
|
| 1033 |
+
"7663 75e0f3c5-de1e-4e6a-96dc-1d3542dc5259 15263810 327865 \n",
|
| 1034 |
+
"1418 9470b0d1-c077-41a1-ac09-6bfae0735e4f 2647 45511277 \n",
|
| 1035 |
+
"8008 07ce200b-c168-4706-9328-5aa02eee1d73 22969028 1012078 \n",
|
| 1036 |
+
"6762 a1b441ac-8f72-41d5-9f89-db95ad09ea43 29679324 23668991 \n",
|
| 1037 |
+
"2846 cd86b9c7-31dc-4906-9536-05d64e2759ca 28928692 45518912 \n",
|
| 1038 |
+
"8111 91c6b4dd-c199-45fb-97cd-6bc9e4c7fbe6 29033057 963751 \n",
|
| 1039 |
+
"\n",
|
| 1040 |
+
" kingdom phylum class order family \\\n",
|
| 1041 |
+
"4462 Animalia Chordata Mammalia Primates Atelidae \n",
|
| 1042 |
+
"3229 Animalia Chordata Aves Passeriformes Mimidae \n",
|
| 1043 |
+
"5172 Animalia Chordata Mammalia Artiodactyla Bovidae \n",
|
| 1044 |
+
"9542 Animalia Chordata Aves Strigiformes Strigidae \n",
|
| 1045 |
+
"7663 Animalia Chordata Mammalia Chiroptera Phyllostomidae \n",
|
| 1046 |
+
"1418 Animalia Chordata Aves Procellariiformes Diomedeidae \n",
|
| 1047 |
+
"8008 Animalia Chordata Actinopterygii Cyprinodontiformes Cyprinodontidae \n",
|
| 1048 |
+
"6762 Animalia Chordata Reptilia Squamata Dactyloidae \n",
|
| 1049 |
+
"2846 Animalia Chordata Aves Charadriiformes Burhinidae \n",
|
| 1050 |
+
"8111 Animalia Chordata Reptilia Squamata Iguanidae \n",
|
| 1051 |
+
"\n",
|
| 1052 |
+
" genus species sciName \n",
|
| 1053 |
+
"4462 Alouatta caraya Alouatta caraya \n",
|
| 1054 |
+
"3229 Mimus macdonaldi Mimus macdonaldi \n",
|
| 1055 |
+
"5172 Procapra picticaudata Procapra picticaudata \n",
|
| 1056 |
+
"9542 Athene blewitti Athene blewitti \n",
|
| 1057 |
+
"7663 Choeronycteris mexicana Choeronycteris mexicana \n",
|
| 1058 |
+
"1418 Thalassarche chlororhynchos Thalassarche chlororhynchos \n",
|
| 1059 |
+
"8008 Cyprinodon macularius Cyprinodon macularius \n",
|
| 1060 |
+
"6762 Anolis monteverde Anolis monteverde \n",
|
| 1061 |
+
"2846 Esacus recurvirostris Esacus recurvirostris \n",
|
| 1062 |
+
"8111 Ctenosaura bakeri Ctenosaura bakeri "
|
| 1063 |
+
]
|
| 1064 |
+
},
|
| 1065 |
+
"execution_count": 12,
|
| 1066 |
+
"metadata": {},
|
| 1067 |
+
"output_type": "execute_result"
|
| 1068 |
+
}
|
| 1069 |
+
],
|
| 1070 |
+
"source": [
|
| 1071 |
+
"updated_catalog.sample(10)"
|
| 1072 |
+
]
|
| 1073 |
+
},
|
| 1074 |
+
{
|
| 1075 |
+
"cell_type": "markdown",
|
| 1076 |
+
"metadata": {},
|
| 1077 |
+
"source": [
|
| 1078 |
+
"Looks good, precisely as expected. Let's save this to a CSV now."
|
| 1079 |
+
]
|
| 1080 |
+
},
|
| 1081 |
+
{
|
| 1082 |
+
"cell_type": "code",
|
| 1083 |
+
"execution_count": 13,
|
| 1084 |
+
"metadata": {},
|
| 1085 |
+
"outputs": [],
|
| 1086 |
+
"source": [
|
| 1087 |
+
"updated_catalog.to_csv(RS_FILEPATH + \"rarespecies-catalog.csv\", index = False)"
|
| 1088 |
+
]
|
| 1089 |
+
},
|
| 1090 |
+
{
|
| 1091 |
+
"cell_type": "markdown",
|
| 1092 |
+
"metadata": {},
|
| 1093 |
+
"source": [
|
| 1094 |
+
"## Add common name column\n",
|
| 1095 |
+
"\n",
|
| 1096 |
+
"Common names have now been requested, so we'll pull those in (from [`predicted-catalog.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/main/data/predicted-catalog.csv), [v3.3](https://huggingface.co/datasets/imageomics/ToL-EDA/commit/5260e84802d2910eedc2a206e7be035cf28f64d4)).\n",
|
| 1097 |
+
"\n",
|
| 1098 |
+
"Updating [`rarespecies-catalog.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/49400c376e62866be1c5038b673d2ebb002c0540/rare_species/data/rarespecies-catalog.csv)."
|
| 1099 |
+
]
|
| 1100 |
+
},
|
| 1101 |
+
{
|
| 1102 |
+
"cell_type": "code",
|
| 1103 |
+
"execution_count": 5,
|
| 1104 |
+
"metadata": {},
|
| 1105 |
+
"outputs": [],
|
| 1106 |
+
"source": [
|
| 1107 |
+
"# pull our updated catalog back in\n",
|
| 1108 |
+
"updated_catalog = pd.read_csv(RS_FILEPATH + \"rarespecies-catalog.csv\",\n",
|
| 1109 |
+
" low_memory=False,\n",
|
| 1110 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})"
|
| 1111 |
+
]
|
| 1112 |
+
},
|
| 1113 |
+
{
|
| 1114 |
+
"cell_type": "code",
|
| 1115 |
+
"execution_count": 4,
|
| 1116 |
+
"metadata": {},
|
| 1117 |
+
"outputs": [],
|
| 1118 |
+
"source": [
|
| 1119 |
+
"pred_cat = pd.read_csv(\"../../data/predicted-catalog.csv\", low_memory=False)"
|
| 1120 |
+
]
|
| 1121 |
+
},
|
| 1122 |
+
{
|
| 1123 |
+
"cell_type": "markdown",
|
| 1124 |
+
"metadata": {},
|
| 1125 |
+
"source": [
|
| 1126 |
+
"Reduce to just images sourced from EOL, cast content and page ids to `int64` for proper matching (will check there aren't different common name labels for some entries), then reduce to just Rare Species pages."
|
| 1127 |
+
]
|
| 1128 |
+
},
|
| 1129 |
+
{
|
| 1130 |
+
"cell_type": "code",
|
| 1131 |
+
"execution_count": 7,
|
| 1132 |
+
"metadata": {},
|
| 1133 |
+
"outputs": [
|
| 1134 |
+
{
|
| 1135 |
+
"data": {
|
| 1136 |
+
"text/plain": [
|
| 1137 |
+
"eol_content_id 22580\n",
|
| 1138 |
+
"eol_page_id 400\n",
|
| 1139 |
+
"kingdom 1\n",
|
| 1140 |
+
"phylum 5\n",
|
| 1141 |
+
"class 15\n",
|
| 1142 |
+
"order 85\n",
|
| 1143 |
+
"family 202\n",
|
| 1144 |
+
"genus 316\n",
|
| 1145 |
+
"species 385\n",
|
| 1146 |
+
"common 398\n",
|
| 1147 |
+
"dtype: int64"
|
| 1148 |
+
]
|
| 1149 |
+
},
|
| 1150 |
+
"execution_count": 7,
|
| 1151 |
+
"metadata": {},
|
| 1152 |
+
"output_type": "execute_result"
|
| 1153 |
+
}
|
| 1154 |
+
],
|
| 1155 |
+
"source": [
|
| 1156 |
+
"eol_pred = pred_cat.loc[pred_cat[\"eol_content_id\"].notna()]\n",
|
| 1157 |
+
"eol_pred = eol_pred.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 1158 |
+
"rs_pred = eol_pred.loc[eol_pred[\"eol_page_id\"].isin(list(updated_catalog.eol_page_id.unique()))]\n",
|
| 1159 |
+
"\n",
|
| 1160 |
+
"cols_interest = list(updated_catalog.columns)[1:-1]\n",
|
| 1161 |
+
"cols_interest.append(\"common\")\n",
|
| 1162 |
+
"rs_pred[cols_interest].nunique()"
|
| 1163 |
+
]
|
| 1164 |
+
},
|
| 1165 |
+
{
|
| 1166 |
+
"cell_type": "markdown",
|
| 1167 |
+
"metadata": {},
|
| 1168 |
+
"source": [
|
| 1169 |
+
"We don't seem to have unique common names for all of these entries. Let's find out what's duplicated."
|
| 1170 |
+
]
|
| 1171 |
+
},
|
| 1172 |
+
{
|
| 1173 |
+
"cell_type": "code",
|
| 1174 |
+
"execution_count": 9,
|
| 1175 |
+
"metadata": {},
|
| 1176 |
+
"outputs": [
|
| 1177 |
+
{
|
| 1178 |
+
"name": "stderr",
|
| 1179 |
+
"output_type": "stream",
|
| 1180 |
+
"text": [
|
| 1181 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_63935/2578193768.py:1: SettingWithCopyWarning: \n",
|
| 1182 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 1183 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 1184 |
+
"\n",
|
| 1185 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 1186 |
+
" rs_pred[\"duplicate_page\"] = rs_pred.duplicated(\"eol_page_id\", keep = \"first\")\n"
|
| 1187 |
+
]
|
| 1188 |
+
},
|
| 1189 |
+
{
|
| 1190 |
+
"data": {
|
| 1191 |
+
"text/html": [
|
| 1192 |
+
"<div>\n",
|
| 1193 |
+
"<style scoped>\n",
|
| 1194 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1195 |
+
" vertical-align: middle;\n",
|
| 1196 |
+
" }\n",
|
| 1197 |
+
"\n",
|
| 1198 |
+
" .dataframe tbody tr th {\n",
|
| 1199 |
+
" vertical-align: top;\n",
|
| 1200 |
+
" }\n",
|
| 1201 |
+
"\n",
|
| 1202 |
+
" .dataframe thead th {\n",
|
| 1203 |
+
" text-align: right;\n",
|
| 1204 |
+
" }\n",
|
| 1205 |
+
"</style>\n",
|
| 1206 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1207 |
+
" <thead>\n",
|
| 1208 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1209 |
+
" <th></th>\n",
|
| 1210 |
+
" <th>eol_content_id</th>\n",
|
| 1211 |
+
" <th>eol_page_id</th>\n",
|
| 1212 |
+
" <th>kingdom</th>\n",
|
| 1213 |
+
" <th>phylum</th>\n",
|
| 1214 |
+
" <th>class</th>\n",
|
| 1215 |
+
" <th>order</th>\n",
|
| 1216 |
+
" <th>family</th>\n",
|
| 1217 |
+
" <th>genus</th>\n",
|
| 1218 |
+
" <th>species</th>\n",
|
| 1219 |
+
" <th>common</th>\n",
|
| 1220 |
+
" <th>duplicate_common</th>\n",
|
| 1221 |
+
" </tr>\n",
|
| 1222 |
+
" </thead>\n",
|
| 1223 |
+
" <tbody>\n",
|
| 1224 |
+
" <tr>\n",
|
| 1225 |
+
" <th>53510</th>\n",
|
| 1226 |
+
" <td>14217127</td>\n",
|
| 1227 |
+
" <td>45276300</td>\n",
|
| 1228 |
+
" <td>Animalia</td>\n",
|
| 1229 |
+
" <td>Cnidaria</td>\n",
|
| 1230 |
+
" <td>Anthozoa</td>\n",
|
| 1231 |
+
" <td>Scleractinia</td>\n",
|
| 1232 |
+
" <td>Acroporidae</td>\n",
|
| 1233 |
+
" <td>Acropora</td>\n",
|
| 1234 |
+
" <td>millepora</td>\n",
|
| 1235 |
+
" <td>staghorn coral</td>\n",
|
| 1236 |
+
" <td>True</td>\n",
|
| 1237 |
+
" </tr>\n",
|
| 1238 |
+
" <tr>\n",
|
| 1239 |
+
" <th>95841</th>\n",
|
| 1240 |
+
" <td>28509006</td>\n",
|
| 1241 |
+
" <td>332461</td>\n",
|
| 1242 |
+
" <td>Animalia</td>\n",
|
| 1243 |
+
" <td>Chordata</td>\n",
|
| 1244 |
+
" <td>Amphibia</td>\n",
|
| 1245 |
+
" <td>Caudata</td>\n",
|
| 1246 |
+
" <td>Salamandridae</td>\n",
|
| 1247 |
+
" <td>Tylototriton</td>\n",
|
| 1248 |
+
" <td>verrucosus</td>\n",
|
| 1249 |
+
" <td>Yunnan Newt</td>\n",
|
| 1250 |
+
" <td>True</td>\n",
|
| 1251 |
+
" </tr>\n",
|
| 1252 |
+
" </tbody>\n",
|
| 1253 |
+
"</table>\n",
|
| 1254 |
+
"</div>"
|
| 1255 |
+
],
|
| 1256 |
+
"text/plain": [
|
| 1257 |
+
" eol_content_id eol_page_id kingdom phylum class \\\n",
|
| 1258 |
+
"53510 14217127 45276300 Animalia Cnidaria Anthozoa \n",
|
| 1259 |
+
"95841 28509006 332461 Animalia Chordata Amphibia \n",
|
| 1260 |
+
"\n",
|
| 1261 |
+
" order family genus species common \\\n",
|
| 1262 |
+
"53510 Scleractinia Acroporidae Acropora millepora staghorn coral \n",
|
| 1263 |
+
"95841 Caudata Salamandridae Tylototriton verrucosus Yunnan Newt \n",
|
| 1264 |
+
"\n",
|
| 1265 |
+
" duplicate_common \n",
|
| 1266 |
+
"53510 True \n",
|
| 1267 |
+
"95841 True "
|
| 1268 |
+
]
|
| 1269 |
+
},
|
| 1270 |
+
"execution_count": 9,
|
| 1271 |
+
"metadata": {},
|
| 1272 |
+
"output_type": "execute_result"
|
| 1273 |
+
}
|
| 1274 |
+
],
|
| 1275 |
+
"source": [
|
| 1276 |
+
"rs_pred[\"duplicate_page\"] = rs_pred.duplicated(\"eol_page_id\", keep = \"first\")\n",
|
| 1277 |
+
"single_page = rs_pred.loc[~rs_pred[\"duplicate_page\"]]\n",
|
| 1278 |
+
"single_page = single_page[cols_interest]\n",
|
| 1279 |
+
"single_page[\"duplicate_common\"] = rs_pred.duplicated(\"common\", keep = \"first\")\n",
|
| 1280 |
+
"\n",
|
| 1281 |
+
"single_page.loc[single_page[\"duplicate_common\"]]"
|
| 1282 |
+
]
|
| 1283 |
+
},
|
| 1284 |
+
{
|
| 1285 |
+
"cell_type": "code",
|
| 1286 |
+
"execution_count": 10,
|
| 1287 |
+
"metadata": {},
|
| 1288 |
+
"outputs": [
|
| 1289 |
+
{
|
| 1290 |
+
"data": {
|
| 1291 |
+
"text/plain": [
|
| 1292 |
+
"(400, 11)"
|
| 1293 |
+
]
|
| 1294 |
+
},
|
| 1295 |
+
"execution_count": 10,
|
| 1296 |
+
"metadata": {},
|
| 1297 |
+
"output_type": "execute_result"
|
| 1298 |
+
}
|
| 1299 |
+
],
|
| 1300 |
+
"source": [
|
| 1301 |
+
"single_page.shape"
|
| 1302 |
+
]
|
| 1303 |
+
},
|
| 1304 |
+
{
|
| 1305 |
+
"cell_type": "code",
|
| 1306 |
+
"execution_count": 11,
|
| 1307 |
+
"metadata": {},
|
| 1308 |
+
"outputs": [
|
| 1309 |
+
{
|
| 1310 |
+
"data": {
|
| 1311 |
+
"text/html": [
|
| 1312 |
+
"<div>\n",
|
| 1313 |
+
"<style scoped>\n",
|
| 1314 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1315 |
+
" vertical-align: middle;\n",
|
| 1316 |
+
" }\n",
|
| 1317 |
+
"\n",
|
| 1318 |
+
" .dataframe tbody tr th {\n",
|
| 1319 |
+
" vertical-align: top;\n",
|
| 1320 |
+
" }\n",
|
| 1321 |
+
"\n",
|
| 1322 |
+
" .dataframe thead th {\n",
|
| 1323 |
+
" text-align: right;\n",
|
| 1324 |
+
" }\n",
|
| 1325 |
+
"</style>\n",
|
| 1326 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1327 |
+
" <thead>\n",
|
| 1328 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1329 |
+
" <th></th>\n",
|
| 1330 |
+
" <th>eol_content_id</th>\n",
|
| 1331 |
+
" <th>eol_page_id</th>\n",
|
| 1332 |
+
" <th>kingdom</th>\n",
|
| 1333 |
+
" <th>phylum</th>\n",
|
| 1334 |
+
" <th>class</th>\n",
|
| 1335 |
+
" <th>order</th>\n",
|
| 1336 |
+
" <th>family</th>\n",
|
| 1337 |
+
" <th>genus</th>\n",
|
| 1338 |
+
" <th>species</th>\n",
|
| 1339 |
+
" <th>common</th>\n",
|
| 1340 |
+
" <th>duplicate_common</th>\n",
|
| 1341 |
+
" </tr>\n",
|
| 1342 |
+
" </thead>\n",
|
| 1343 |
+
" <tbody>\n",
|
| 1344 |
+
" <tr>\n",
|
| 1345 |
+
" <th>5280</th>\n",
|
| 1346 |
+
" <td>28261341</td>\n",
|
| 1347 |
+
" <td>45276299</td>\n",
|
| 1348 |
+
" <td>Animalia</td>\n",
|
| 1349 |
+
" <td>Cnidaria</td>\n",
|
| 1350 |
+
" <td>Anthozoa</td>\n",
|
| 1351 |
+
" <td>Scleractinia</td>\n",
|
| 1352 |
+
" <td>Acroporidae</td>\n",
|
| 1353 |
+
" <td>Acropora</td>\n",
|
| 1354 |
+
" <td>acuminata</td>\n",
|
| 1355 |
+
" <td>staghorn coral</td>\n",
|
| 1356 |
+
" <td>False</td>\n",
|
| 1357 |
+
" </tr>\n",
|
| 1358 |
+
" <tr>\n",
|
| 1359 |
+
" <th>17074</th>\n",
|
| 1360 |
+
" <td>8777107</td>\n",
|
| 1361 |
+
" <td>331513</td>\n",
|
| 1362 |
+
" <td>Animalia</td>\n",
|
| 1363 |
+
" <td>Chordata</td>\n",
|
| 1364 |
+
" <td>Amphibia</td>\n",
|
| 1365 |
+
" <td>Caudata</td>\n",
|
| 1366 |
+
" <td>Salamandridae</td>\n",
|
| 1367 |
+
" <td>Tylototriton</td>\n",
|
| 1368 |
+
" <td>shanjing</td>\n",
|
| 1369 |
+
" <td>Yunnan Newt</td>\n",
|
| 1370 |
+
" <td>False</td>\n",
|
| 1371 |
+
" </tr>\n",
|
| 1372 |
+
" <tr>\n",
|
| 1373 |
+
" <th>53510</th>\n",
|
| 1374 |
+
" <td>14217127</td>\n",
|
| 1375 |
+
" <td>45276300</td>\n",
|
| 1376 |
+
" <td>Animalia</td>\n",
|
| 1377 |
+
" <td>Cnidaria</td>\n",
|
| 1378 |
+
" <td>Anthozoa</td>\n",
|
| 1379 |
+
" <td>Scleractinia</td>\n",
|
| 1380 |
+
" <td>Acroporidae</td>\n",
|
| 1381 |
+
" <td>Acropora</td>\n",
|
| 1382 |
+
" <td>millepora</td>\n",
|
| 1383 |
+
" <td>staghorn coral</td>\n",
|
| 1384 |
+
" <td>True</td>\n",
|
| 1385 |
+
" </tr>\n",
|
| 1386 |
+
" <tr>\n",
|
| 1387 |
+
" <th>95841</th>\n",
|
| 1388 |
+
" <td>28509006</td>\n",
|
| 1389 |
+
" <td>332461</td>\n",
|
| 1390 |
+
" <td>Animalia</td>\n",
|
| 1391 |
+
" <td>Chordata</td>\n",
|
| 1392 |
+
" <td>Amphibia</td>\n",
|
| 1393 |
+
" <td>Caudata</td>\n",
|
| 1394 |
+
" <td>Salamandridae</td>\n",
|
| 1395 |
+
" <td>Tylototriton</td>\n",
|
| 1396 |
+
" <td>verrucosus</td>\n",
|
| 1397 |
+
" <td>Yunnan Newt</td>\n",
|
| 1398 |
+
" <td>True</td>\n",
|
| 1399 |
+
" </tr>\n",
|
| 1400 |
+
" </tbody>\n",
|
| 1401 |
+
"</table>\n",
|
| 1402 |
+
"</div>"
|
| 1403 |
+
],
|
| 1404 |
+
"text/plain": [
|
| 1405 |
+
" eol_content_id eol_page_id kingdom phylum class \\\n",
|
| 1406 |
+
"5280 28261341 45276299 Animalia Cnidaria Anthozoa \n",
|
| 1407 |
+
"17074 8777107 331513 Animalia Chordata Amphibia \n",
|
| 1408 |
+
"53510 14217127 45276300 Animalia Cnidaria Anthozoa \n",
|
| 1409 |
+
"95841 28509006 332461 Animalia Chordata Amphibia \n",
|
| 1410 |
+
"\n",
|
| 1411 |
+
" order family genus species common \\\n",
|
| 1412 |
+
"5280 Scleractinia Acroporidae Acropora acuminata staghorn coral \n",
|
| 1413 |
+
"17074 Caudata Salamandridae Tylototriton shanjing Yunnan Newt \n",
|
| 1414 |
+
"53510 Scleractinia Acroporidae Acropora millepora staghorn coral \n",
|
| 1415 |
+
"95841 Caudata Salamandridae Tylototriton verrucosus Yunnan Newt \n",
|
| 1416 |
+
"\n",
|
| 1417 |
+
" duplicate_common \n",
|
| 1418 |
+
"5280 False \n",
|
| 1419 |
+
"17074 False \n",
|
| 1420 |
+
"53510 True \n",
|
| 1421 |
+
"95841 True "
|
| 1422 |
+
]
|
| 1423 |
+
},
|
| 1424 |
+
"execution_count": 11,
|
| 1425 |
+
"metadata": {},
|
| 1426 |
+
"output_type": "execute_result"
|
| 1427 |
+
}
|
| 1428 |
+
],
|
| 1429 |
+
"source": [
|
| 1430 |
+
"duplicated_common_names = [\"staghorn coral\", \"Yunnan Newt\"]\n",
|
| 1431 |
+
"single_page.loc[single_page[\"common\"].isin(duplicated_common_names)]"
|
| 1432 |
+
]
|
| 1433 |
+
},
|
| 1434 |
+
{
|
| 1435 |
+
"cell_type": "markdown",
|
| 1436 |
+
"metadata": {},
|
| 1437 |
+
"source": [
|
| 1438 |
+
"So we have two common names that are each used for two species (within the same genus). That's not terribly unusual, but good to know.\n",
|
| 1439 |
+
"\n",
|
| 1440 |
+
"### Add the Common Name Column"
|
| 1441 |
+
]
|
| 1442 |
+
},
|
| 1443 |
+
{
|
| 1444 |
+
"cell_type": "code",
|
| 1445 |
+
"execution_count": 14,
|
| 1446 |
+
"metadata": {},
|
| 1447 |
+
"outputs": [
|
| 1448 |
+
{
|
| 1449 |
+
"data": {
|
| 1450 |
+
"text/plain": [
|
| 1451 |
+
"rarespecies_id 11983\n",
|
| 1452 |
+
"eol_content_id 11983\n",
|
| 1453 |
+
"eol_page_id 400\n",
|
| 1454 |
+
"kingdom 1\n",
|
| 1455 |
+
"phylum 5\n",
|
| 1456 |
+
"class 15\n",
|
| 1457 |
+
"order 85\n",
|
| 1458 |
+
"family 202\n",
|
| 1459 |
+
"genus 316\n",
|
| 1460 |
+
"species 385\n",
|
| 1461 |
+
"sciName 400\n",
|
| 1462 |
+
"common 398\n",
|
| 1463 |
+
"dtype: int64"
|
| 1464 |
+
]
|
| 1465 |
+
},
|
| 1466 |
+
"execution_count": 14,
|
| 1467 |
+
"metadata": {},
|
| 1468 |
+
"output_type": "execute_result"
|
| 1469 |
+
}
|
| 1470 |
+
],
|
| 1471 |
+
"source": [
|
| 1472 |
+
"def get_common_name(page_id):\n",
|
| 1473 |
+
" return single_page.loc[single_page[\"eol_page_id\"] == page_id, \"common\"].values[0]\n",
|
| 1474 |
+
"\n",
|
| 1475 |
+
"updated_catalog[\"common\"] = updated_catalog[\"eol_page_id\"].apply(get_common_name)\n",
|
| 1476 |
+
"updated_catalog.nunique()"
|
| 1477 |
+
]
|
| 1478 |
+
},
|
| 1479 |
+
{
|
| 1480 |
+
"cell_type": "markdown",
|
| 1481 |
+
"metadata": {},
|
| 1482 |
+
"source": [
|
| 1483 |
+
"### Save Updated Version with Common Names"
|
| 1484 |
+
]
|
| 1485 |
+
},
|
| 1486 |
+
{
|
| 1487 |
+
"cell_type": "code",
|
| 1488 |
+
"execution_count": 15,
|
| 1489 |
+
"metadata": {},
|
| 1490 |
+
"outputs": [],
|
| 1491 |
+
"source": [
|
| 1492 |
+
"updated_catalog.to_csv(RS_FILEPATH + \"rarespecies-catalog.csv\", index = False)"
|
| 1493 |
+
]
|
| 1494 |
+
},
|
| 1495 |
+
{
|
| 1496 |
+
"cell_type": "code",
|
| 1497 |
+
"execution_count": null,
|
| 1498 |
+
"metadata": {},
|
| 1499 |
+
"outputs": [],
|
| 1500 |
+
"source": []
|
| 1501 |
+
}
|
| 1502 |
+
],
|
| 1503 |
+
"metadata": {
|
| 1504 |
+
"jupytext": {
|
| 1505 |
+
"formats": "ipynb,py:percent"
|
| 1506 |
+
},
|
| 1507 |
+
"kernelspec": {
|
| 1508 |
+
"display_name": "tol",
|
| 1509 |
+
"language": "python",
|
| 1510 |
+
"name": "python3"
|
| 1511 |
+
},
|
| 1512 |
+
"language_info": {
|
| 1513 |
+
"codemirror_mode": {
|
| 1514 |
+
"name": "ipython",
|
| 1515 |
+
"version": 3
|
| 1516 |
+
},
|
| 1517 |
+
"file_extension": ".py",
|
| 1518 |
+
"mimetype": "text/x-python",
|
| 1519 |
+
"name": "python",
|
| 1520 |
+
"nbconvert_exporter": "python",
|
| 1521 |
+
"pygments_lexer": "ipython3",
|
| 1522 |
+
"version": "3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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 2,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import pandas as pd"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cell_type": "code",
|
| 14 |
+
"execution_count": 3,
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"outputs": [],
|
| 17 |
+
"source": [
|
| 18 |
+
"TOL_FILEPATH = \"../../data/\""
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "markdown",
|
| 23 |
+
"metadata": {},
|
| 24 |
+
"source": [
|
| 25 |
+
"### Read in Complete EOL TreeOfLife-10M Manifest\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"[`combined-manifest-licenses.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/48af9b74b7a05a03b9a807a5b7b591fbf574eaec/eol_realign/data/combined-manifest-licenses.csv) is [`eol-cargo-archive_catalog_combined-manifest-checksums_links.csv`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/48af9b74b7a05a03b9a807a5b7b591fbf574eaec/eol_realign/data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv) run through the `owner_match` and `make_licenses` scripts."
|
| 28 |
+
]
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"cell_type": "code",
|
| 32 |
+
"execution_count": 4,
|
| 33 |
+
"metadata": {},
|
| 34 |
+
"outputs": [
|
| 35 |
+
{
|
| 36 |
+
"name": "stdout",
|
| 37 |
+
"output_type": "stream",
|
| 38 |
+
"text": [
|
| 39 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 40 |
+
"RangeIndex: 6841202 entries, 0 to 6841201\n",
|
| 41 |
+
"Data columns (total 32 columns):\n",
|
| 42 |
+
" # Column Non-Null Count Dtype \n",
|
| 43 |
+
"--- ------ -------------- ----- \n",
|
| 44 |
+
" 0 filename_archive 6841202 non-null object \n",
|
| 45 |
+
" 1 md5 6841202 non-null object \n",
|
| 46 |
+
" 2 combined_id_archive 6841202 non-null object \n",
|
| 47 |
+
" 3 split 6841202 non-null object \n",
|
| 48 |
+
" 4 treeoflife_id 6841202 non-null object \n",
|
| 49 |
+
" 5 bioscan_part 0 non-null float64\n",
|
| 50 |
+
" 6 bioscan_filename 0 non-null float64\n",
|
| 51 |
+
" 7 inat21_filename 0 non-null float64\n",
|
| 52 |
+
" 8 inat21_cls_name 0 non-null float64\n",
|
| 53 |
+
" 9 inat21_cls_num 0 non-null float64\n",
|
| 54 |
+
" 10 kingdom 6551473 non-null object \n",
|
| 55 |
+
" 11 phylum 6553206 non-null object \n",
|
| 56 |
+
" 12 class 6532009 non-null object \n",
|
| 57 |
+
" 13 order 6525621 non-null object \n",
|
| 58 |
+
" 14 family 6506076 non-null object \n",
|
| 59 |
+
" 15 genus 6486130 non-null object \n",
|
| 60 |
+
" 16 species 6406307 non-null object \n",
|
| 61 |
+
" 17 common 6841202 non-null object \n",
|
| 62 |
+
" 18 combined_id_catalog 6841202 non-null object \n",
|
| 63 |
+
" 19 filename_manifest 6841202 non-null object \n",
|
| 64 |
+
" 20 combined_id_manifest_redownload 6841202 non-null object \n",
|
| 65 |
+
" 21 medium_source_url 6841202 non-null object \n",
|
| 66 |
+
" 22 eol_full_size_copy_url 6841202 non-null object \n",
|
| 67 |
+
" 23 license_name 6841202 non-null object \n",
|
| 68 |
+
" 24 copyright_owner 6841202 non-null object \n",
|
| 69 |
+
" 25 expected_image_filename 6841202 non-null object \n",
|
| 70 |
+
" 26 source_0706 6841202 non-null bool \n",
|
| 71 |
+
" 27 source_0726 6841202 non-null bool \n",
|
| 72 |
+
" 28 source_1206 6841202 non-null bool \n",
|
| 73 |
+
" 29 combined_id_full_manifest 6841202 non-null object \n",
|
| 74 |
+
" 30 title 6841202 non-null object \n",
|
| 75 |
+
" 31 license_link 6809751 non-null object \n",
|
| 76 |
+
"dtypes: bool(3), float64(5), object(24)\n",
|
| 77 |
+
"memory usage: 1.5+ GB\n"
|
| 78 |
+
]
|
| 79 |
+
}
|
| 80 |
+
],
|
| 81 |
+
"source": [
|
| 82 |
+
"manifest = pd.read_csv(\"../data/combined-manifest-licenses.csv\",\n",
|
| 83 |
+
" low_memory=False,\n",
|
| 84 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 85 |
+
"manifest.info(show_counts = True)"
|
| 86 |
+
]
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"cell_type": "code",
|
| 90 |
+
"execution_count": 5,
|
| 91 |
+
"metadata": {},
|
| 92 |
+
"outputs": [
|
| 93 |
+
{
|
| 94 |
+
"data": {
|
| 95 |
+
"text/plain": [
|
| 96 |
+
"treeoflife_id 6219674\n",
|
| 97 |
+
"md5 6146917\n",
|
| 98 |
+
"filename_archive 6219674\n",
|
| 99 |
+
"filename_manifest 6608194\n",
|
| 100 |
+
"expected_image_filename 6608194\n",
|
| 101 |
+
"combined_id_full_manifest 6608194\n",
|
| 102 |
+
"dtype: int64"
|
| 103 |
+
]
|
| 104 |
+
},
|
| 105 |
+
"execution_count": 5,
|
| 106 |
+
"metadata": {},
|
| 107 |
+
"output_type": "execute_result"
|
| 108 |
+
}
|
| 109 |
+
],
|
| 110 |
+
"source": [
|
| 111 |
+
"manifest[[\"treeoflife_id\", \"md5\", \"filename_archive\", \"filename_manifest\",\"expected_image_filename\", \"combined_id_full_manifest\"]].nunique()"
|
| 112 |
+
]
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"cell_type": "markdown",
|
| 116 |
+
"metadata": {},
|
| 117 |
+
"source": [
|
| 118 |
+
"## Read in TreeOfLife-10M Catalog"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "markdown",
|
| 123 |
+
"metadata": {},
|
| 124 |
+
"source": [
|
| 125 |
+
"Note that we will use [`catalog`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/main/data/catalog.csv) from v3.3 EDA update [commit](https://huggingface.co/datasets/imageomics/ToL-EDA/commit/5260e84802d2910eedc2a206e7be035cf28f64d4). This is the version reported in the paper and in visualizations that will be included with the initial dataset publication; the patch will have updated visuals to match with this version.\n",
|
| 126 |
+
"(renamed locally to `catalog-orig-v3-3.csv`)."
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"cell_type": "code",
|
| 131 |
+
"execution_count": 6,
|
| 132 |
+
"metadata": {},
|
| 133 |
+
"outputs": [
|
| 134 |
+
{
|
| 135 |
+
"name": "stdout",
|
| 136 |
+
"output_type": "stream",
|
| 137 |
+
"text": [
|
| 138 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 139 |
+
"RangeIndex: 11021779 entries, 0 to 11021778\n",
|
| 140 |
+
"Data columns (total 17 columns):\n",
|
| 141 |
+
" # Column Non-Null Count Dtype \n",
|
| 142 |
+
"--- ------ -------------- ----- \n",
|
| 143 |
+
" 0 split 11021779 non-null object \n",
|
| 144 |
+
" 1 treeoflife_id 11021779 non-null object \n",
|
| 145 |
+
" 2 eol_content_id 6844184 non-null float64\n",
|
| 146 |
+
" 3 eol_page_id 6844184 non-null float64\n",
|
| 147 |
+
" 4 bioscan_part 1235502 non-null float64\n",
|
| 148 |
+
" 5 bioscan_filename 1235502 non-null object \n",
|
| 149 |
+
" 6 inat21_filename 2942093 non-null object \n",
|
| 150 |
+
" 7 inat21_cls_name 2942093 non-null object \n",
|
| 151 |
+
" 8 inat21_cls_num 2942093 non-null float64\n",
|
| 152 |
+
" 9 kingdom 10736334 non-null object \n",
|
| 153 |
+
" 10 phylum 10738087 non-null object \n",
|
| 154 |
+
" 11 class 10716389 non-null object \n",
|
| 155 |
+
" 12 order 10709733 non-null object \n",
|
| 156 |
+
" 13 family 10674746 non-null object \n",
|
| 157 |
+
" 14 genus 9725443 non-null object \n",
|
| 158 |
+
" 15 species 9551602 non-null object \n",
|
| 159 |
+
" 16 common 11021779 non-null object \n",
|
| 160 |
+
"dtypes: float64(4), object(13)\n",
|
| 161 |
+
"memory usage: 1.4+ GB\n"
|
| 162 |
+
]
|
| 163 |
+
}
|
| 164 |
+
],
|
| 165 |
+
"source": [
|
| 166 |
+
"catalog_orig = pd.read_csv(TOL_FILEPATH + \"catalog-orig-v3-3.csv\",\n",
|
| 167 |
+
" low_memory=False\n",
|
| 168 |
+
" )\n",
|
| 169 |
+
"catalog_orig.info(show_counts = True)"
|
| 170 |
+
]
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"cell_type": "markdown",
|
| 174 |
+
"metadata": {},
|
| 175 |
+
"source": [
|
| 176 |
+
"Separate out the EOL portion from the BIOSCAN & iNat21 portion, that way we can merge the EOL part with the manifest (requires casting the EOL content & page IDs to `int64` and combining them with an underscore to merge on the `combined_id_full_manifest`) to get the licenses and create a clear `ToL_manifest` like with rarespecies. Then we can concatenate the adjusted EOL portion with the BIOSCAN & iNat21 portion to reconstruct the catalog."
|
| 177 |
+
]
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"cell_type": "code",
|
| 181 |
+
"execution_count": 7,
|
| 182 |
+
"metadata": {},
|
| 183 |
+
"outputs": [],
|
| 184 |
+
"source": [
|
| 185 |
+
"# EOL portion of the catalog\n",
|
| 186 |
+
"eol_catalog = catalog_orig.loc[catalog_orig[\"eol_content_id\"].notna()]\n",
|
| 187 |
+
"\n",
|
| 188 |
+
"# BIOSCAN & iNat portion of the catalog\n",
|
| 189 |
+
"bin_catalog = catalog_orig.loc[catalog_orig[\"eol_content_id\"].isna()]"
|
| 190 |
+
]
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"cell_type": "markdown",
|
| 194 |
+
"metadata": {},
|
| 195 |
+
"source": [
|
| 196 |
+
"Recast EOL content and page IDs as `int64` in combined ID generation. Need to leave them as they are for re-concatenating with the other portion of the catalog."
|
| 197 |
+
]
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"cell_type": "code",
|
| 201 |
+
"execution_count": 8,
|
| 202 |
+
"metadata": {},
|
| 203 |
+
"outputs": [
|
| 204 |
+
{
|
| 205 |
+
"name": "stderr",
|
| 206 |
+
"output_type": "stream",
|
| 207 |
+
"text": [
|
| 208 |
+
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_59366/112309718.py:1: SettingWithCopyWarning: \n",
|
| 209 |
+
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
| 210 |
+
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
| 211 |
+
"\n",
|
| 212 |
+
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
| 213 |
+
" eol_catalog[\"combined_id_catalog\"] = eol_catalog[\"eol_content_id\"].astype(int).astype(str) + \"_\" + eol_catalog[\"eol_page_id\"].astype(int).astype(str)\n"
|
| 214 |
+
]
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"data": {
|
| 218 |
+
"text/html": [
|
| 219 |
+
"<div>\n",
|
| 220 |
+
"<style scoped>\n",
|
| 221 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 222 |
+
" vertical-align: middle;\n",
|
| 223 |
+
" }\n",
|
| 224 |
+
"\n",
|
| 225 |
+
" .dataframe tbody tr th {\n",
|
| 226 |
+
" vertical-align: top;\n",
|
| 227 |
+
" }\n",
|
| 228 |
+
"\n",
|
| 229 |
+
" .dataframe thead th {\n",
|
| 230 |
+
" text-align: right;\n",
|
| 231 |
+
" }\n",
|
| 232 |
+
"</style>\n",
|
| 233 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 234 |
+
" <thead>\n",
|
| 235 |
+
" <tr style=\"text-align: right;\">\n",
|
| 236 |
+
" <th></th>\n",
|
| 237 |
+
" <th>split</th>\n",
|
| 238 |
+
" <th>treeoflife_id</th>\n",
|
| 239 |
+
" <th>eol_content_id</th>\n",
|
| 240 |
+
" <th>eol_page_id</th>\n",
|
| 241 |
+
" <th>bioscan_part</th>\n",
|
| 242 |
+
" <th>bioscan_filename</th>\n",
|
| 243 |
+
" <th>inat21_filename</th>\n",
|
| 244 |
+
" <th>inat21_cls_name</th>\n",
|
| 245 |
+
" <th>inat21_cls_num</th>\n",
|
| 246 |
+
" <th>kingdom</th>\n",
|
| 247 |
+
" <th>phylum</th>\n",
|
| 248 |
+
" <th>class</th>\n",
|
| 249 |
+
" <th>order</th>\n",
|
| 250 |
+
" <th>family</th>\n",
|
| 251 |
+
" <th>genus</th>\n",
|
| 252 |
+
" <th>species</th>\n",
|
| 253 |
+
" <th>common</th>\n",
|
| 254 |
+
" <th>combined_id_catalog</th>\n",
|
| 255 |
+
" </tr>\n",
|
| 256 |
+
" </thead>\n",
|
| 257 |
+
" <tbody>\n",
|
| 258 |
+
" <tr>\n",
|
| 259 |
+
" <th>0</th>\n",
|
| 260 |
+
" <td>train_small</td>\n",
|
| 261 |
+
" <td>a87c78c0-eb7c-45ee-9a98-681f61292d6b</td>\n",
|
| 262 |
+
" <td>29586132.0</td>\n",
|
| 263 |
+
" <td>65441690.0</td>\n",
|
| 264 |
+
" <td>NaN</td>\n",
|
| 265 |
+
" <td>NaN</td>\n",
|
| 266 |
+
" <td>NaN</td>\n",
|
| 267 |
+
" <td>NaN</td>\n",
|
| 268 |
+
" <td>NaN</td>\n",
|
| 269 |
+
" <td>Animalia</td>\n",
|
| 270 |
+
" <td>Arthropoda</td>\n",
|
| 271 |
+
" <td>Insecta</td>\n",
|
| 272 |
+
" <td>Lepidoptera</td>\n",
|
| 273 |
+
" <td>Nymphalidae</td>\n",
|
| 274 |
+
" <td>Acraea</td>\n",
|
| 275 |
+
" <td>terpsicore</td>\n",
|
| 276 |
+
" <td>Tawny Coster</td>\n",
|
| 277 |
+
" <td>29586132_65441690</td>\n",
|
| 278 |
+
" </tr>\n",
|
| 279 |
+
" <tr>\n",
|
| 280 |
+
" <th>1</th>\n",
|
| 281 |
+
" <td>train_small</td>\n",
|
| 282 |
+
" <td>f8158395-d663-4f0f-b38d-1c6ecb16a8ca</td>\n",
|
| 283 |
+
" <td>29811010.0</td>\n",
|
| 284 |
+
" <td>45510040.0</td>\n",
|
| 285 |
+
" <td>NaN</td>\n",
|
| 286 |
+
" <td>NaN</td>\n",
|
| 287 |
+
" <td>NaN</td>\n",
|
| 288 |
+
" <td>NaN</td>\n",
|
| 289 |
+
" <td>NaN</td>\n",
|
| 290 |
+
" <td>Animalia</td>\n",
|
| 291 |
+
" <td>Chordata</td>\n",
|
| 292 |
+
" <td>Aves</td>\n",
|
| 293 |
+
" <td>Passeriformes</td>\n",
|
| 294 |
+
" <td>Pycnonotidae</td>\n",
|
| 295 |
+
" <td>Pycnonotus</td>\n",
|
| 296 |
+
" <td>cafer</td>\n",
|
| 297 |
+
" <td>Red-vented Bulbul</td>\n",
|
| 298 |
+
" <td>29811010_45510040</td>\n",
|
| 299 |
+
" </tr>\n",
|
| 300 |
+
" <tr>\n",
|
| 301 |
+
" <th>2</th>\n",
|
| 302 |
+
" <td>train_small</td>\n",
|
| 303 |
+
" <td>63aab6e3-b01d-4259-be13-9dd41becaf29</td>\n",
|
| 304 |
+
" <td>28563112.0</td>\n",
|
| 305 |
+
" <td>736062.0</td>\n",
|
| 306 |
+
" <td>NaN</td>\n",
|
| 307 |
+
" <td>NaN</td>\n",
|
| 308 |
+
" <td>NaN</td>\n",
|
| 309 |
+
" <td>NaN</td>\n",
|
| 310 |
+
" <td>NaN</td>\n",
|
| 311 |
+
" <td>Animalia</td>\n",
|
| 312 |
+
" <td>Arthropoda</td>\n",
|
| 313 |
+
" <td>Insecta</td>\n",
|
| 314 |
+
" <td>Diptera</td>\n",
|
| 315 |
+
" <td>Empididae</td>\n",
|
| 316 |
+
" <td>Rhamphomyia</td>\n",
|
| 317 |
+
" <td>limbata</td>\n",
|
| 318 |
+
" <td>Rhamphomyia limbata</td>\n",
|
| 319 |
+
" <td>28563112_736062</td>\n",
|
| 320 |
+
" </tr>\n",
|
| 321 |
+
" <tr>\n",
|
| 322 |
+
" <th>3</th>\n",
|
| 323 |
+
" <td>train_small</td>\n",
|
| 324 |
+
" <td>cf2d58e1-d504-489c-80dd-e99407f8c13d</td>\n",
|
| 325 |
+
" <td>29002118.0</td>\n",
|
| 326 |
+
" <td>349296.0</td>\n",
|
| 327 |
+
" <td>NaN</td>\n",
|
| 328 |
+
" <td>NaN</td>\n",
|
| 329 |
+
" <td>NaN</td>\n",
|
| 330 |
+
" <td>NaN</td>\n",
|
| 331 |
+
" <td>NaN</td>\n",
|
| 332 |
+
" <td>Animalia</td>\n",
|
| 333 |
+
" <td>Arthropoda</td>\n",
|
| 334 |
+
" <td>Insecta</td>\n",
|
| 335 |
+
" <td>Lepidoptera</td>\n",
|
| 336 |
+
" <td>Geometridae</td>\n",
|
| 337 |
+
" <td>Exelis</td>\n",
|
| 338 |
+
" <td>pyrolaria</td>\n",
|
| 339 |
+
" <td>Fine Lined Gray</td>\n",
|
| 340 |
+
" <td>29002118_349296</td>\n",
|
| 341 |
+
" </tr>\n",
|
| 342 |
+
" </tbody>\n",
|
| 343 |
+
"</table>\n",
|
| 344 |
+
"</div>"
|
| 345 |
+
],
|
| 346 |
+
"text/plain": [
|
| 347 |
+
" split treeoflife_id eol_content_id \\\n",
|
| 348 |
+
"0 train_small a87c78c0-eb7c-45ee-9a98-681f61292d6b 29586132.0 \n",
|
| 349 |
+
"1 train_small f8158395-d663-4f0f-b38d-1c6ecb16a8ca 29811010.0 \n",
|
| 350 |
+
"2 train_small 63aab6e3-b01d-4259-be13-9dd41becaf29 28563112.0 \n",
|
| 351 |
+
"3 train_small cf2d58e1-d504-489c-80dd-e99407f8c13d 29002118.0 \n",
|
| 352 |
+
"\n",
|
| 353 |
+
" eol_page_id bioscan_part bioscan_filename inat21_filename inat21_cls_name \\\n",
|
| 354 |
+
"0 65441690.0 NaN NaN NaN NaN \n",
|
| 355 |
+
"1 45510040.0 NaN NaN NaN NaN \n",
|
| 356 |
+
"2 736062.0 NaN NaN NaN NaN \n",
|
| 357 |
+
"3 349296.0 NaN NaN NaN NaN \n",
|
| 358 |
+
"\n",
|
| 359 |
+
" inat21_cls_num kingdom phylum class order family \\\n",
|
| 360 |
+
"0 NaN Animalia Arthropoda Insecta Lepidoptera Nymphalidae \n",
|
| 361 |
+
"1 NaN Animalia Chordata Aves Passeriformes Pycnonotidae \n",
|
| 362 |
+
"2 NaN Animalia Arthropoda Insecta Diptera Empididae \n",
|
| 363 |
+
"3 NaN Animalia Arthropoda Insecta Lepidoptera Geometridae \n",
|
| 364 |
+
"\n",
|
| 365 |
+
" genus species common combined_id_catalog \n",
|
| 366 |
+
"0 Acraea terpsicore Tawny Coster 29586132_65441690 \n",
|
| 367 |
+
"1 Pycnonotus cafer Red-vented Bulbul 29811010_45510040 \n",
|
| 368 |
+
"2 Rhamphomyia limbata Rhamphomyia limbata 28563112_736062 \n",
|
| 369 |
+
"3 Exelis pyrolaria Fine Lined Gray 29002118_349296 "
|
| 370 |
+
]
|
| 371 |
+
},
|
| 372 |
+
"execution_count": 8,
|
| 373 |
+
"metadata": {},
|
| 374 |
+
"output_type": "execute_result"
|
| 375 |
+
}
|
| 376 |
+
],
|
| 377 |
+
"source": [
|
| 378 |
+
"eol_catalog[\"combined_id_catalog\"] = eol_catalog[\"eol_content_id\"].astype(int).astype(str) + \"_\" + eol_catalog[\"eol_page_id\"].astype(int).astype(str)\n",
|
| 379 |
+
"eol_catalog.head(4)"
|
| 380 |
+
]
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"cell_type": "markdown",
|
| 384 |
+
"metadata": {},
|
| 385 |
+
"source": [
|
| 386 |
+
"Keep in mind, we will have some repeated entries due to the `train_small` split, so we will merge on just `split != \"train_small\"`"
|
| 387 |
+
]
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"cell_type": "code",
|
| 391 |
+
"execution_count": 9,
|
| 392 |
+
"metadata": {},
|
| 393 |
+
"outputs": [],
|
| 394 |
+
"source": [
|
| 395 |
+
"train_val_eol_catalog = eol_catalog.loc[eol_catalog[\"split\"] != \"train_small\"]"
|
| 396 |
+
]
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"cell_type": "code",
|
| 400 |
+
"execution_count": 10,
|
| 401 |
+
"metadata": {},
|
| 402 |
+
"outputs": [
|
| 403 |
+
{
|
| 404 |
+
"name": "stdout",
|
| 405 |
+
"output_type": "stream",
|
| 406 |
+
"text": [
|
| 407 |
+
"We should have 6250420 entries in our merge, minus the approximately 30K we couldn't match.\n"
|
| 408 |
+
]
|
| 409 |
+
}
|
| 410 |
+
],
|
| 411 |
+
"source": [
|
| 412 |
+
"print(f\"We should have {train_val_eol_catalog.shape[0]} entries in our merge, minus the approximately 30K we couldn't match.\")"
|
| 413 |
+
]
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"cell_type": "markdown",
|
| 417 |
+
"metadata": {},
|
| 418 |
+
"source": [
|
| 419 |
+
"We should have 6,250,420 entries in our merge, minus the approximately 30K we couldn't match.. The expectation is that this will be 6,219,674 entries. Details on this expectation & the `train_small` implications can be found in [`eol_realign/notebooks/links_align_reduced.ipynb`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/3438fe9a88c0f377a4d8ac4c6c0de796858a08ac/eol_realign/notebooks/links_align_reduced.ipynb)."
|
| 420 |
+
]
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"cell_type": "code",
|
| 424 |
+
"execution_count": 11,
|
| 425 |
+
"metadata": {},
|
| 426 |
+
"outputs": [],
|
| 427 |
+
"source": [
|
| 428 |
+
"# Catalog Columns\n",
|
| 429 |
+
"id_cols = [\"treeoflife_id\", \"eol_content_id\", \"eol_page_id\", \"combined_id_catalog\"]\n",
|
| 430 |
+
"\n",
|
| 431 |
+
"# Manifest Columns\n",
|
| 432 |
+
"manifest_cols = [\"treeoflife_id\",\n",
|
| 433 |
+
" \"md5\",\n",
|
| 434 |
+
" \"medium_source_url\",\n",
|
| 435 |
+
" \"eol_full_size_copy_url\",\n",
|
| 436 |
+
" \"license_name\",\n",
|
| 437 |
+
" \"copyright_owner\",\n",
|
| 438 |
+
" \"license_link\",\n",
|
| 439 |
+
" \"title\",\n",
|
| 440 |
+
" \"filename_archive\",\n",
|
| 441 |
+
" \"filename_manifest\",\n",
|
| 442 |
+
" \"expected_image_filename\",\n",
|
| 443 |
+
" \"combined_id_full_manifest\"]"
|
| 444 |
+
]
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"cell_type": "code",
|
| 448 |
+
"execution_count": 12,
|
| 449 |
+
"metadata": {},
|
| 450 |
+
"outputs": [
|
| 451 |
+
{
|
| 452 |
+
"name": "stdout",
|
| 453 |
+
"output_type": "stream",
|
| 454 |
+
"text": [
|
| 455 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 456 |
+
"RangeIndex: 6841202 entries, 0 to 6841201\n",
|
| 457 |
+
"Data columns (total 15 columns):\n",
|
| 458 |
+
" # Column Non-Null Count Dtype \n",
|
| 459 |
+
"--- ------ -------------- ----- \n",
|
| 460 |
+
" 0 treeoflife_id 6841202 non-null object \n",
|
| 461 |
+
" 1 eol_content_id 6841202 non-null float64\n",
|
| 462 |
+
" 2 eol_page_id 6841202 non-null float64\n",
|
| 463 |
+
" 3 combined_id_catalog 6841202 non-null object \n",
|
| 464 |
+
" 4 md5 6841202 non-null object \n",
|
| 465 |
+
" 5 medium_source_url 6841202 non-null object \n",
|
| 466 |
+
" 6 eol_full_size_copy_url 6841202 non-null object \n",
|
| 467 |
+
" 7 license_name 6841202 non-null object \n",
|
| 468 |
+
" 8 copyright_owner 6841202 non-null object \n",
|
| 469 |
+
" 9 license_link 6809751 non-null object \n",
|
| 470 |
+
" 10 title 6841202 non-null object \n",
|
| 471 |
+
" 11 filename_archive 6841202 non-null object \n",
|
| 472 |
+
" 12 filename_manifest 6841202 non-null object \n",
|
| 473 |
+
" 13 expected_image_filename 6841202 non-null object \n",
|
| 474 |
+
" 14 combined_id_full_manifest 6841202 non-null object \n",
|
| 475 |
+
"dtypes: float64(2), object(13)\n",
|
| 476 |
+
"memory usage: 782.9+ MB\n"
|
| 477 |
+
]
|
| 478 |
+
}
|
| 479 |
+
],
|
| 480 |
+
"source": [
|
| 481 |
+
"tol_manifest = pd.merge(train_val_eol_catalog[id_cols],\n",
|
| 482 |
+
" manifest[manifest_cols],\n",
|
| 483 |
+
" on = \"treeoflife_id\",\n",
|
| 484 |
+
" how = \"inner\")\n",
|
| 485 |
+
"tol_manifest.info(show_counts = True)"
|
| 486 |
+
]
|
| 487 |
+
},
|
| 488 |
+
{
|
| 489 |
+
"cell_type": "code",
|
| 490 |
+
"execution_count": 13,
|
| 491 |
+
"metadata": {},
|
| 492 |
+
"outputs": [
|
| 493 |
+
{
|
| 494 |
+
"data": {
|
| 495 |
+
"text/plain": [
|
| 496 |
+
"treeoflife_id 6219674\n",
|
| 497 |
+
"eol_content_id 6219674\n",
|
| 498 |
+
"eol_page_id 501807\n",
|
| 499 |
+
"combined_id_catalog 6219674\n",
|
| 500 |
+
"md5 6146917\n",
|
| 501 |
+
"medium_source_url 6217871\n",
|
| 502 |
+
"eol_full_size_copy_url 6247692\n",
|
| 503 |
+
"license_name 16\n",
|
| 504 |
+
"copyright_owner 403215\n",
|
| 505 |
+
"license_link 11\n",
|
| 506 |
+
"title 482137\n",
|
| 507 |
+
"filename_archive 6219674\n",
|
| 508 |
+
"filename_manifest 6608194\n",
|
| 509 |
+
"expected_image_filename 6608194\n",
|
| 510 |
+
"combined_id_full_manifest 6608194\n",
|
| 511 |
+
"dtype: int64"
|
| 512 |
+
]
|
| 513 |
+
},
|
| 514 |
+
"execution_count": 13,
|
| 515 |
+
"metadata": {},
|
| 516 |
+
"output_type": "execute_result"
|
| 517 |
+
}
|
| 518 |
+
],
|
| 519 |
+
"source": [
|
| 520 |
+
"tol_manifest.nunique()"
|
| 521 |
+
]
|
| 522 |
+
},
|
| 523 |
+
{
|
| 524 |
+
"cell_type": "markdown",
|
| 525 |
+
"metadata": {},
|
| 526 |
+
"source": [
|
| 527 |
+
"Let's reduce this down to just the unique `treeoflife_id`s. All URLs are valid and the EOL content and page IDs (plus `combined_id_catalog` will match the filenames we have saved)."
|
| 528 |
+
]
|
| 529 |
+
},
|
| 530 |
+
{
|
| 531 |
+
"cell_type": "code",
|
| 532 |
+
"execution_count": 14,
|
| 533 |
+
"metadata": {},
|
| 534 |
+
"outputs": [
|
| 535 |
+
{
|
| 536 |
+
"name": "stdout",
|
| 537 |
+
"output_type": "stream",
|
| 538 |
+
"text": [
|
| 539 |
+
"(6219674, 16)\n"
|
| 540 |
+
]
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"data": {
|
| 544 |
+
"text/plain": [
|
| 545 |
+
"treeoflife_id 6219674\n",
|
| 546 |
+
"eol_content_id 6219674\n",
|
| 547 |
+
"eol_page_id 501807\n",
|
| 548 |
+
"combined_id_catalog 6219674\n",
|
| 549 |
+
"md5 6146917\n",
|
| 550 |
+
"medium_source_url 6144920\n",
|
| 551 |
+
"eol_full_size_copy_url 6146917\n",
|
| 552 |
+
"license_name 16\n",
|
| 553 |
+
"copyright_owner 398253\n",
|
| 554 |
+
"license_link 11\n",
|
| 555 |
+
"title 475702\n",
|
| 556 |
+
"filename_archive 6219674\n",
|
| 557 |
+
"filename_manifest 6146917\n",
|
| 558 |
+
"expected_image_filename 6146917\n",
|
| 559 |
+
"combined_id_full_manifest 6146917\n",
|
| 560 |
+
"duplicate_tol_id 1\n",
|
| 561 |
+
"dtype: int64"
|
| 562 |
+
]
|
| 563 |
+
},
|
| 564 |
+
"execution_count": 14,
|
| 565 |
+
"metadata": {},
|
| 566 |
+
"output_type": "execute_result"
|
| 567 |
+
}
|
| 568 |
+
],
|
| 569 |
+
"source": [
|
| 570 |
+
"tol_manifest[\"duplicate_tol_id\"] = tol_manifest.duplicated(\"treeoflife_id\", keep = \"first\")\n",
|
| 571 |
+
"tol_manifest = tol_manifest.loc[~tol_manifest[\"duplicate_tol_id\"]]\n",
|
| 572 |
+
"\n",
|
| 573 |
+
"print(tol_manifest.shape)\n",
|
| 574 |
+
"tol_manifest.nunique()"
|
| 575 |
+
]
|
| 576 |
+
},
|
| 577 |
+
{
|
| 578 |
+
"cell_type": "markdown",
|
| 579 |
+
"metadata": {},
|
| 580 |
+
"source": [
|
| 581 |
+
"Clearly, these match with the archive filenames.\n",
|
| 582 |
+
"\n",
|
| 583 |
+
"Our numbers match the expected count. Let's check our `copyright_owner` and `title` coverage. "
|
| 584 |
+
]
|
| 585 |
+
},
|
| 586 |
+
{
|
| 587 |
+
"cell_type": "code",
|
| 588 |
+
"execution_count": 15,
|
| 589 |
+
"metadata": {},
|
| 590 |
+
"outputs": [
|
| 591 |
+
{
|
| 592 |
+
"data": {
|
| 593 |
+
"text/plain": [
|
| 594 |
+
"license_name\n",
|
| 595 |
+
"No known copyright restrictions 7389\n",
|
| 596 |
+
"cc-by-nc-sa-3.0 4247\n",
|
| 597 |
+
"cc-publicdomain 3422\n",
|
| 598 |
+
"cc-by-nc 3029\n",
|
| 599 |
+
"cc-by-3.0 470\n",
|
| 600 |
+
"cc-by-sa-3.0 171\n",
|
| 601 |
+
"cc-0-1.0 32\n",
|
| 602 |
+
"cc-by-nc-2.0 2\n",
|
| 603 |
+
"cc-by-nc-4.0 1\n",
|
| 604 |
+
"Name: count, dtype: int64"
|
| 605 |
+
]
|
| 606 |
+
},
|
| 607 |
+
"execution_count": 15,
|
| 608 |
+
"metadata": {},
|
| 609 |
+
"output_type": "execute_result"
|
| 610 |
+
}
|
| 611 |
+
],
|
| 612 |
+
"source": [
|
| 613 |
+
"tol_manifest.loc[tol_manifest[\"copyright_owner\"] == \"not provided\", \"license_name\"].value_counts()"
|
| 614 |
+
]
|
| 615 |
+
},
|
| 616 |
+
{
|
| 617 |
+
"cell_type": "code",
|
| 618 |
+
"execution_count": 16,
|
| 619 |
+
"metadata": {},
|
| 620 |
+
"outputs": [
|
| 621 |
+
{
|
| 622 |
+
"data": {
|
| 623 |
+
"text/plain": [
|
| 624 |
+
"license_name\n",
|
| 625 |
+
"cc-by-nc-4.0 2401921\n",
|
| 626 |
+
"cc-by-sa-3.0 760953\n",
|
| 627 |
+
"cc-by-nc-sa-3.0 664194\n",
|
| 628 |
+
"cc-by-3.0 439653\n",
|
| 629 |
+
"cc-by-4.0 368046\n",
|
| 630 |
+
"cc-by-nc 316103\n",
|
| 631 |
+
"cc-by-nc-sa-4.0 184204\n",
|
| 632 |
+
"cc-by-nc-sa 154761\n",
|
| 633 |
+
"cc-publicdomain 129257\n",
|
| 634 |
+
"cc-by-sa-4.0 65003\n",
|
| 635 |
+
"cc-by 58303\n",
|
| 636 |
+
"cc-by-sa-2.0 30157\n",
|
| 637 |
+
"cc-by-nc-2.0 27718\n",
|
| 638 |
+
"cc-0-1.0 20358\n",
|
| 639 |
+
"No known copyright restrictions 16042\n",
|
| 640 |
+
"cc-by-nc-sa-2.5 315\n",
|
| 641 |
+
"Name: count, dtype: int64"
|
| 642 |
+
]
|
| 643 |
+
},
|
| 644 |
+
"execution_count": 16,
|
| 645 |
+
"metadata": {},
|
| 646 |
+
"output_type": "execute_result"
|
| 647 |
+
}
|
| 648 |
+
],
|
| 649 |
+
"source": [
|
| 650 |
+
"tol_manifest.loc[tol_manifest[\"title\"] == \"not provided\", \"license_name\"].value_counts()"
|
| 651 |
+
]
|
| 652 |
+
},
|
| 653 |
+
{
|
| 654 |
+
"cell_type": "markdown",
|
| 655 |
+
"metadata": {},
|
| 656 |
+
"source": [
|
| 657 |
+
"At least most unmatched lack of copyright restrictions or are CC0; we did what we could."
|
| 658 |
+
]
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"cell_type": "markdown",
|
| 662 |
+
"metadata": {},
|
| 663 |
+
"source": [
|
| 664 |
+
"### Save Full Owner Manifest\n"
|
| 665 |
+
]
|
| 666 |
+
},
|
| 667 |
+
{
|
| 668 |
+
"cell_type": "code",
|
| 669 |
+
"execution_count": 17,
|
| 670 |
+
"metadata": {},
|
| 671 |
+
"outputs": [],
|
| 672 |
+
"source": [
|
| 673 |
+
"tol_manifest.to_csv(\"../data/full_owner_manifest.csv\", index = False)"
|
| 674 |
+
]
|
| 675 |
+
},
|
| 676 |
+
{
|
| 677 |
+
"cell_type": "markdown",
|
| 678 |
+
"metadata": {},
|
| 679 |
+
"source": [
|
| 680 |
+
"### Make and Save License File"
|
| 681 |
+
]
|
| 682 |
+
},
|
| 683 |
+
{
|
| 684 |
+
"cell_type": "code",
|
| 685 |
+
"execution_count": 18,
|
| 686 |
+
"metadata": {},
|
| 687 |
+
"outputs": [],
|
| 688 |
+
"source": [
|
| 689 |
+
"licesne_cols = [\"treeoflife_id\",\n",
|
| 690 |
+
" \"eol_content_id\",\n",
|
| 691 |
+
" \"eol_page_id\",\n",
|
| 692 |
+
" \"md5\",\n",
|
| 693 |
+
" \"medium_source_url\",\n",
|
| 694 |
+
" \"eol_full_size_copy_url\",\n",
|
| 695 |
+
" \"license_name\",\n",
|
| 696 |
+
" \"copyright_owner\",\n",
|
| 697 |
+
" \"license_link\",\n",
|
| 698 |
+
" \"title\"]\n",
|
| 699 |
+
"\n",
|
| 700 |
+
"licenses = tol_manifest[licesne_cols]"
|
| 701 |
+
]
|
| 702 |
+
},
|
| 703 |
+
{
|
| 704 |
+
"cell_type": "code",
|
| 705 |
+
"execution_count": 19,
|
| 706 |
+
"metadata": {},
|
| 707 |
+
"outputs": [],
|
| 708 |
+
"source": [
|
| 709 |
+
"licenses.to_csv(TOL_FILEPATH + \"licenses.csv\", index = False)"
|
| 710 |
+
]
|
| 711 |
+
},
|
| 712 |
+
{
|
| 713 |
+
"cell_type": "markdown",
|
| 714 |
+
"metadata": {},
|
| 715 |
+
"source": [
|
| 716 |
+
"## Make Updated Catalog\n",
|
| 717 |
+
"\n",
|
| 718 |
+
"Reconnect the EOL portion of the catalog to the BIOSCAN and iNat21 portion."
|
| 719 |
+
]
|
| 720 |
+
},
|
| 721 |
+
{
|
| 722 |
+
"cell_type": "code",
|
| 723 |
+
"execution_count": 20,
|
| 724 |
+
"metadata": {},
|
| 725 |
+
"outputs": [
|
| 726 |
+
{
|
| 727 |
+
"data": {
|
| 728 |
+
"text/plain": [
|
| 729 |
+
"['split',\n",
|
| 730 |
+
" 'treeoflife_id',\n",
|
| 731 |
+
" 'eol_content_id',\n",
|
| 732 |
+
" 'eol_page_id',\n",
|
| 733 |
+
" 'bioscan_part',\n",
|
| 734 |
+
" 'bioscan_filename',\n",
|
| 735 |
+
" 'inat21_filename',\n",
|
| 736 |
+
" 'inat21_cls_name',\n",
|
| 737 |
+
" 'inat21_cls_num',\n",
|
| 738 |
+
" 'kingdom',\n",
|
| 739 |
+
" 'phylum',\n",
|
| 740 |
+
" 'class',\n",
|
| 741 |
+
" 'order',\n",
|
| 742 |
+
" 'family',\n",
|
| 743 |
+
" 'genus',\n",
|
| 744 |
+
" 'species',\n",
|
| 745 |
+
" 'common']"
|
| 746 |
+
]
|
| 747 |
+
},
|
| 748 |
+
"execution_count": 20,
|
| 749 |
+
"metadata": {},
|
| 750 |
+
"output_type": "execute_result"
|
| 751 |
+
}
|
| 752 |
+
],
|
| 753 |
+
"source": [
|
| 754 |
+
"cat_cols = list(catalog_orig.columns)\n",
|
| 755 |
+
"cat_cols"
|
| 756 |
+
]
|
| 757 |
+
},
|
| 758 |
+
{
|
| 759 |
+
"cell_type": "markdown",
|
| 760 |
+
"metadata": {},
|
| 761 |
+
"source": [
|
| 762 |
+
"Need to first reduce the `eol_catalog` (still has the `train_small` split we want to keep).\n",
|
| 763 |
+
"\n",
|
| 764 |
+
"BIOSCAN & iNat portion of the catalog: `bin_catalog`"
|
| 765 |
+
]
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"cell_type": "code",
|
| 769 |
+
"execution_count": 21,
|
| 770 |
+
"metadata": {},
|
| 771 |
+
"outputs": [
|
| 772 |
+
{
|
| 773 |
+
"name": "stdout",
|
| 774 |
+
"output_type": "stream",
|
| 775 |
+
"text": [
|
| 776 |
+
"(6810437, 18)\n"
|
| 777 |
+
]
|
| 778 |
+
},
|
| 779 |
+
{
|
| 780 |
+
"data": {
|
| 781 |
+
"text/plain": [
|
| 782 |
+
"6219674"
|
| 783 |
+
]
|
| 784 |
+
},
|
| 785 |
+
"execution_count": 21,
|
| 786 |
+
"metadata": {},
|
| 787 |
+
"output_type": "execute_result"
|
| 788 |
+
}
|
| 789 |
+
],
|
| 790 |
+
"source": [
|
| 791 |
+
"matched_tol_ids = list(tol_manifest.treeoflife_id)\n",
|
| 792 |
+
"\n",
|
| 793 |
+
"reduced_eol_cat = eol_catalog.loc[eol_catalog[\"treeoflife_id\"].isin(matched_tol_ids)]\n",
|
| 794 |
+
"\n",
|
| 795 |
+
"#check we have expected numbers (6,219,674 + 590,730 = 6,810,404, still only 6,219,674 unique)\n",
|
| 796 |
+
"print(reduced_eol_cat.shape)\n",
|
| 797 |
+
"reduced_eol_cat.treeoflife_id.nunique()"
|
| 798 |
+
]
|
| 799 |
+
},
|
| 800 |
+
{
|
| 801 |
+
"cell_type": "markdown",
|
| 802 |
+
"metadata": {},
|
| 803 |
+
"source": [
|
| 804 |
+
"Looks like we recovered 33 more from the small train set than we expected. These came from the archive recovery (had we merged on `combined_id_archive` instead of `combined_id_full_manifest` in [`links_align_reduced.ipynb`](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/3438fe9a88c0f377a4d8ac4c6c0de796858a08ac/eol_realign/notebooks/links_align_reduced.ipynb), would have seen that difference)."
|
| 805 |
+
]
|
| 806 |
+
},
|
| 807 |
+
{
|
| 808 |
+
"cell_type": "code",
|
| 809 |
+
"execution_count": 24,
|
| 810 |
+
"metadata": {},
|
| 811 |
+
"outputs": [
|
| 812 |
+
{
|
| 813 |
+
"name": "stdout",
|
| 814 |
+
"output_type": "stream",
|
| 815 |
+
"text": [
|
| 816 |
+
"The BIOSCAN & iNate portion have 4177595 total images, with 3815156 unique entries.\n"
|
| 817 |
+
]
|
| 818 |
+
}
|
| 819 |
+
],
|
| 820 |
+
"source": [
|
| 821 |
+
"print(f\"The BIOSCAN & iNate portion have {bin_catalog.shape[0]} total images, with {bin_catalog.treeoflife_id.nunique()} unique entries.\")"
|
| 822 |
+
]
|
| 823 |
+
},
|
| 824 |
+
{
|
| 825 |
+
"cell_type": "markdown",
|
| 826 |
+
"metadata": {},
|
| 827 |
+
"source": [
|
| 828 |
+
"We have expected 10,034,830 unique entries in the final set, 10,988,032 total entries."
|
| 829 |
+
]
|
| 830 |
+
},
|
| 831 |
+
{
|
| 832 |
+
"cell_type": "code",
|
| 833 |
+
"execution_count": 25,
|
| 834 |
+
"metadata": {},
|
| 835 |
+
"outputs": [
|
| 836 |
+
{
|
| 837 |
+
"name": "stdout",
|
| 838 |
+
"output_type": "stream",
|
| 839 |
+
"text": [
|
| 840 |
+
"(10988032, 17)\n"
|
| 841 |
+
]
|
| 842 |
+
},
|
| 843 |
+
{
|
| 844 |
+
"data": {
|
| 845 |
+
"text/plain": [
|
| 846 |
+
"split 3\n",
|
| 847 |
+
"treeoflife_id 10034830\n",
|
| 848 |
+
"eol_content_id 6219674\n",
|
| 849 |
+
"eol_page_id 501807\n",
|
| 850 |
+
"bioscan_part 113\n",
|
| 851 |
+
"bioscan_filename 1128313\n",
|
| 852 |
+
"inat21_filename 2686843\n",
|
| 853 |
+
"inat21_cls_name 10000\n",
|
| 854 |
+
"inat21_cls_num 10000\n",
|
| 855 |
+
"kingdom 12\n",
|
| 856 |
+
"phylum 108\n",
|
| 857 |
+
"class 347\n",
|
| 858 |
+
"order 1495\n",
|
| 859 |
+
"family 7954\n",
|
| 860 |
+
"genus 73687\n",
|
| 861 |
+
"species 163001\n",
|
| 862 |
+
"common 442253\n",
|
| 863 |
+
"dtype: int64"
|
| 864 |
+
]
|
| 865 |
+
},
|
| 866 |
+
"execution_count": 25,
|
| 867 |
+
"metadata": {},
|
| 868 |
+
"output_type": "execute_result"
|
| 869 |
+
}
|
| 870 |
+
],
|
| 871 |
+
"source": [
|
| 872 |
+
"updated_catalog = pd.concat([reduced_eol_cat[cat_cols], bin_catalog], ignore_index = True)\n",
|
| 873 |
+
"\n",
|
| 874 |
+
"print(updated_catalog.shape)\n",
|
| 875 |
+
"updated_catalog.nunique()"
|
| 876 |
+
]
|
| 877 |
+
},
|
| 878 |
+
{
|
| 879 |
+
"cell_type": "markdown",
|
| 880 |
+
"metadata": {},
|
| 881 |
+
"source": [
|
| 882 |
+
"Looks good, precisely as expected. Let's save this to a CSV now."
|
| 883 |
+
]
|
| 884 |
+
},
|
| 885 |
+
{
|
| 886 |
+
"cell_type": "code",
|
| 887 |
+
"execution_count": 26,
|
| 888 |
+
"metadata": {},
|
| 889 |
+
"outputs": [],
|
| 890 |
+
"source": [
|
| 891 |
+
"updated_catalog.to_csv(TOL_FILEPATH + \"catalog.csv\", index = False)"
|
| 892 |
+
]
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"cell_type": "code",
|
| 896 |
+
"execution_count": null,
|
| 897 |
+
"metadata": {},
|
| 898 |
+
"outputs": [],
|
| 899 |
+
"source": []
|
| 900 |
+
}
|
| 901 |
+
],
|
| 902 |
+
"metadata": {
|
| 903 |
+
"jupytext": {
|
| 904 |
+
"formats": "ipynb,py:percent"
|
| 905 |
+
},
|
| 906 |
+
"kernelspec": {
|
| 907 |
+
"display_name": "tol",
|
| 908 |
+
"language": "python",
|
| 909 |
+
"name": "python3"
|
| 910 |
+
},
|
| 911 |
+
"language_info": {
|
| 912 |
+
"codemirror_mode": {
|
| 913 |
+
"name": "ipython",
|
| 914 |
+
"version": 3
|
| 915 |
+
},
|
| 916 |
+
"file_extension": ".py",
|
| 917 |
+
"mimetype": "text/x-python",
|
| 918 |
+
"name": "python",
|
| 919 |
+
"nbconvert_exporter": "python",
|
| 920 |
+
"pygments_lexer": "ipython3",
|
| 921 |
+
"version": "3.11.3"
|
| 922 |
+
}
|
| 923 |
+
},
|
| 924 |
+
"nbformat": 4,
|
| 925 |
+
"nbformat_minor": 2
|
| 926 |
+
}
|
eol_realign/scripts/make_licenses.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import argparse
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
# Output of match_owners.py (combined_manifest.csv) should be fed in.
|
| 7 |
+
|
| 8 |
+
CC_URL = "https://creativecommons.org/"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_license_url(license_version):
|
| 12 |
+
"""
|
| 13 |
+
Function to generate the appropriate Creative Commons URL for a given license.
|
| 14 |
+
All licenses in the media manifest are "cc-XX", a variation on "publicdomain", or "No known copyright restrictions".
|
| 15 |
+
|
| 16 |
+
Parameters:
|
| 17 |
+
-----------
|
| 18 |
+
license_version - String. License (eg., "cc-by-nc 3.0").
|
| 19 |
+
|
| 20 |
+
Returns:
|
| 21 |
+
--------
|
| 22 |
+
license_url - String. Creative Commons URL associated with the license_version.
|
| 23 |
+
|
| 24 |
+
"""
|
| 25 |
+
# First check for version number and isolate it
|
| 26 |
+
if "." in license_version:
|
| 27 |
+
version = license_version.split(sep="-")[-1]
|
| 28 |
+
license_name = license_version.split(sep="-" + version)[0]
|
| 29 |
+
else:
|
| 30 |
+
# No version specified, so default to latest version (4.0)
|
| 31 |
+
license_name = license_version
|
| 32 |
+
version = "4.0"
|
| 33 |
+
# Check which type of license
|
| 34 |
+
if license_name[:5] == "cc-by":
|
| 35 |
+
by_x = license_name.split(sep="cc-")[1]
|
| 36 |
+
license_url = CC_URL + "licenses/" + by_x + "/" + version
|
| 37 |
+
elif (license_name[:4] == "cc-0") or ("public" in license_name):
|
| 38 |
+
license_url = CC_URL + "publicdomain/zero/1.0"
|
| 39 |
+
else:
|
| 40 |
+
# "No known copyright restrictions"
|
| 41 |
+
license_url = None
|
| 42 |
+
return license_url
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def main(src_csv, dest_dir):
|
| 46 |
+
# Check CSV compatibility
|
| 47 |
+
try:
|
| 48 |
+
print("Reading CSV")
|
| 49 |
+
df = pd.read_csv(src_csv, low_memory=False)
|
| 50 |
+
except Exception as e:
|
| 51 |
+
sys.exit(e)
|
| 52 |
+
|
| 53 |
+
# Check for "License Name" or "license_name" column
|
| 54 |
+
print("Processing data")
|
| 55 |
+
df_cols = list(df.columns)
|
| 56 |
+
if "License Name" not in df_cols:
|
| 57 |
+
if "license_name" not in df_cols:
|
| 58 |
+
sys.exit("Source CSV does not have a column labeled License Name or license_name.")
|
| 59 |
+
license_col = "license_name"
|
| 60 |
+
else:
|
| 61 |
+
license_col = "License Name"
|
| 62 |
+
|
| 63 |
+
# Check filepath given by user
|
| 64 |
+
dest_dir_path = Path(dest_dir)
|
| 65 |
+
if not dest_dir_path.is_absolute():
|
| 66 |
+
# Use ToL-EDA as reference folder
|
| 67 |
+
base_path = Path(__file__).parent.parent.resolve()
|
| 68 |
+
filepath = base_path / dest_dir_path
|
| 69 |
+
else:
|
| 70 |
+
filepath = dest_dir_path
|
| 71 |
+
|
| 72 |
+
filepath.mkdir(parents=True, exist_ok=True)
|
| 73 |
+
|
| 74 |
+
# Add links for licenses to combined manifest
|
| 75 |
+
print("Getting URLs for licenses")
|
| 76 |
+
df["license_link"] = df[license_col].apply(get_license_url)
|
| 77 |
+
|
| 78 |
+
# Save license file
|
| 79 |
+
df.to_csv(str(filepath / "combined-manifest-licenses.csv"), index=False)
|
| 80 |
+
|
| 81 |
+
# Print counts of licenses for which URL was not resolved
|
| 82 |
+
print(
|
| 83 |
+
"Licenses with no URL: \n",
|
| 84 |
+
df.loc[df["license_link"].isna(), license_col].value_counts(),
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
if __name__ == "__main__":
|
| 89 |
+
parser = argparse.ArgumentParser(
|
| 90 |
+
description="Add license URLs to combined manifest file"
|
| 91 |
+
)
|
| 92 |
+
parser.add_argument("input_file", help="Path to the input CSV file")
|
| 93 |
+
parser.add_argument(
|
| 94 |
+
"--output_path",
|
| 95 |
+
default="data",
|
| 96 |
+
required=False,
|
| 97 |
+
help="Path to the folder for output license file",
|
| 98 |
+
)
|
| 99 |
+
args = parser.parse_args()
|
| 100 |
+
|
| 101 |
+
main(args.input_file, args.output_path)
|
eol_realign/scripts/match_owners.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import argparse
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
# NOTE: column names are hard-coded to the files provided in MANIFEST_PATH & OWNER_PATH
|
| 7 |
+
# It is intended to just add the extra licensing information to the combined manifest
|
| 8 |
+
# Owner fix file: https://huggingface.co/datasets/imageomics/eol/blob/main/owners_info_fix/media_manifest_missing_licenses_jul26_owners.csv
|
| 9 |
+
MANIFEST_PATH = "data/eol-cargo-archive_catalog_combined-manifest-checksums_links.csv"
|
| 10 |
+
OWNER_PATH = "data/media_manifest_missing_licenses_jul26_owners.csv"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def get_owners_titles(manifest, owners):
|
| 14 |
+
"""
|
| 15 |
+
Function to attach owner names and image titles to manifest entries in combined manifest.
|
| 16 |
+
Fills empty "Copyright Owner" and "Title" values with "not provided".
|
| 17 |
+
|
| 18 |
+
Parameters:
|
| 19 |
+
-----------
|
| 20 |
+
manifest - DataFrame composed of manifest entries aligned on MD5s from three different manifests,
|
| 21 |
+
includes columns "md5_combined_manifest", "combined_id_full_manifest".
|
| 22 |
+
owners - DataFrame of July 26, 2023 media manifest entries that had missing owners, updated with their information.
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
--------
|
| 26 |
+
full_owner_manifest - Media manifest DataFrame with missing owners resolved.
|
| 27 |
+
num_matched - Number of records matched with the owner fix file.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
# First merge owners
|
| 31 |
+
owners_manifest = pd.merge(owners,
|
| 32 |
+
manifest,
|
| 33 |
+
left_on="combined_id_owner",
|
| 34 |
+
right_on = "combined_id_full_manifest",
|
| 35 |
+
how = "inner")
|
| 36 |
+
|
| 37 |
+
# Set "copyright_owner" column to owners patched in owner CSV
|
| 38 |
+
owners_manifest["copyright_owner"] = owners_manifest["Copyright Owner"]
|
| 39 |
+
|
| 40 |
+
# Preserve columns that match the combined manifest
|
| 41 |
+
license_cols = list(manifest.columns)
|
| 42 |
+
license_cols.append("title")
|
| 43 |
+
owners_manifest = owners_manifest[license_cols]
|
| 44 |
+
|
| 45 |
+
# Get matched owner IDs
|
| 46 |
+
rematched_owner_ids = list(owners_manifest.combined_id_full_manifest.unique())
|
| 47 |
+
num_matched = len(rematched_owner_ids)
|
| 48 |
+
|
| 49 |
+
# Reduce manifest to just records not matched in owner file
|
| 50 |
+
un_matched_owner_manifest = manifest.loc[~manifest.combined_id_full_manifest.isin(rematched_owner_ids)]
|
| 51 |
+
un_matched_owner_manifest["title"] = "not provided"
|
| 52 |
+
|
| 53 |
+
# Align the matched owners with the unmatched
|
| 54 |
+
full_owner_manifest = pd.concat([un_matched_owner_manifest, owners_manifest], ignore_index=True)
|
| 55 |
+
|
| 56 |
+
# Fill null "copyright_owner" and "Title" values with "not provided"
|
| 57 |
+
full_owner_manifest["copyright_owner"].fillna("not provided", inplace=True)
|
| 58 |
+
full_owner_manifest["title"].fillna("not provided", inplace=True)
|
| 59 |
+
|
| 60 |
+
return full_owner_manifest, num_matched
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def update_owners(manifest, owners, filepath):
|
| 64 |
+
"""
|
| 65 |
+
Function to fetch and attach the missing owner and title information to EOL catalog entries and save catalog-media file.
|
| 66 |
+
|
| 67 |
+
Parameters:
|
| 68 |
+
-----------
|
| 69 |
+
manifest - DataFrame composed of manifest entries aligned on MD5s from three different manifests,
|
| 70 |
+
includes columns "md5_combined_manifest", "combined_id_full_manifest".
|
| 71 |
+
owners - DataFrame of July 26, 2023 media manifest entries that had missing owners, updated with their information.
|
| 72 |
+
"""
|
| 73 |
+
# Need combined IDs for the owner match file
|
| 74 |
+
# EOL content & page IDs read in as int64
|
| 75 |
+
owners["combined_id_owner"] = owners["EOL content ID"].astype(str) + "_" + owners["EOL page ID"].astype(str)
|
| 76 |
+
|
| 77 |
+
updated_manifest, num_matched = get_owners_titles(manifest, owners)
|
| 78 |
+
|
| 79 |
+
# Save updated combined manifest file to chosen location
|
| 80 |
+
updated_manifest.to_csv(filepath, index=False)
|
| 81 |
+
|
| 82 |
+
# Print counts of licenses for which owner info was not resolved
|
| 83 |
+
print(f"Of the {manifest.shape[0]} entries in manifest, {num_matched} were matched to the owner fix file.")
|
| 84 |
+
print(
|
| 85 |
+
"Licenses still missing Copyright Owners: \n",
|
| 86 |
+
manifest.loc[
|
| 87 |
+
manifest["copyright_owner"].isna(), "license_name"
|
| 88 |
+
].value_counts(),
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def main(dest_dir):
|
| 93 |
+
# Read in CSVs
|
| 94 |
+
try:
|
| 95 |
+
# Read in media manifest and owner fix CSVs with EOL content and page IDs as type "int64".
|
| 96 |
+
print("Reading combined media manifest CSV")
|
| 97 |
+
manifest = pd.read_csv(
|
| 98 |
+
MANIFEST_PATH,
|
| 99 |
+
low_memory=False,
|
| 100 |
+
)
|
| 101 |
+
print("Reading owner fix CSV")
|
| 102 |
+
owners = pd.read_csv(
|
| 103 |
+
OWNER_PATH,
|
| 104 |
+
dtype={"EOL content ID": "int64", "EOL page ID": "int64"},
|
| 105 |
+
low_memory=False,
|
| 106 |
+
)
|
| 107 |
+
except Exception as e:
|
| 108 |
+
sys.exit(e)
|
| 109 |
+
|
| 110 |
+
# Check filepath given by user
|
| 111 |
+
dest_dir_path = Path(dest_dir)
|
| 112 |
+
if not dest_dir_path.is_absolute():
|
| 113 |
+
# Use ToL-EDA as reference folder
|
| 114 |
+
base_path = Path(__file__).parent.parent.resolve()
|
| 115 |
+
filepath = base_path / dest_dir_path
|
| 116 |
+
else:
|
| 117 |
+
filepath = dest_dir_path
|
| 118 |
+
|
| 119 |
+
filepath.mkdir(parents=True, exist_ok=True)
|
| 120 |
+
|
| 121 |
+
# Make and save updated manifest to chosen filepath
|
| 122 |
+
update_owners(manifest, owners, str(filepath / "combined_manifest.csv"))
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
if __name__ == "__main__":
|
| 126 |
+
parser = argparse.ArgumentParser(description="Attach missing owner info to combined manifest")
|
| 127 |
+
|
| 128 |
+
parser.add_argument(
|
| 129 |
+
"--output_path",
|
| 130 |
+
default="data",
|
| 131 |
+
required=False,
|
| 132 |
+
help="Path to the folder for output combined manifest file",
|
| 133 |
+
)
|
| 134 |
+
args = parser.parse_args()
|
| 135 |
+
|
| 136 |
+
main(args.output_path)
|
rare_species/data/licenses.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
rare_species/data/rarespecies-catalog.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:96c458bd580caf5df4743c639eb38490e62eddef44b92be519d6771bdc2bf8fa
|
| 3 |
+
size 1953805
|
rare_species/data/rarespecies_manifest.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|