Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After running pipeline, Cuculus-micropterus has no occurrences #20

Open
johrstrom opened this issue Nov 8, 2021 · 1 comment
Open

Comments

@johrstrom
Copy link
Contributor

[11] pry(main)> Species.distinct.pluck(:id) - Occurrence.distinct.pluck(:species_id).uniq
   (154.6ms)  SELECT DISTINCT `species`.`id` FROM `species`
   (4.5ms)  SELECT DISTINCT `occurrences`.`species_id` FROM `occurrences`
=> [59884]
[12] pry(main)> Species.find(59884)
  Species Load (0.4ms)  SELECT  `species`.* FROM `species` WHERE `species`.`id` = 59884 LIMIT 1
=> #<Species:0x00000000338d5620
 id: 59884,
 path: "Aves/Cuculiformes/Cuculidae/Cuculus-micropterus",
 total_seqs: 14,
 total_bytes: 10028,
 aligned: true,
 taxon_kingdom: "Animalia",
 taxon_phylum: "Chordata",
 taxon_class: "Aves",
 taxon_order: "Cuculiformes",
 taxon_family: "Cuculidae",
 taxon_genus: "Cuculus",
 taxon_species: "Cuculus micropterus",
 taxon_subspecies: "">
[13] pry(main)> Species.find(59884).occurrences
  Species Load (0.3ms)  SELECT  `species`.* FROM `species` WHERE `species`.`id` = 59884 LIMIT 1
  Occurrence Load (0.4ms)  SELECT `occurrences`.* FROM `occurrences` WHERE `occurrences`.`species_id` = 59884
=> []
[14] pry(main)>
@johrstrom
Copy link
Contributor Author

Another note says:

This may be indicative of a bug. What were the original occurrences, where did they go, why did this get created anyways?

Until then this can just be manually deleted in production by doing:

# give me a list of species id's to delete
Species.where(id: (Species.distinct.pluck(:id) - Occurrence.distinct.pluck(:species_id).uniq)).delete_all 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant