melizalab / django-bird-colony Goto Github PK
View Code? Open in Web Editor NEWBird colony management tool
License: BSD 3-Clause "New" or "Revised" License
Bird colony management tool
License: BSD 3-Clause "New" or "Revised" License
It's tedious to add events for birds with the current solution, which bops you over to the database admin site. It'd be nice to have a prepopulated form.
Unclear if this is the causal factor, but we just added some new birds from another lab who don't have parents, and they're not showing up in the living list even though their living attribute is true. possibly an issue with how livingness is calculated by summing up the event count fields.
Need to be able to edit events sometimes. Would be useful to have a link in the event list that either points to the admin for that event or to a dedicated form.
Currently we're using a google spreadsheet to do daily nest checks, and there's a lot of duplicated effort and opportunities for error. It would be nice to have nest checks integrated with the colony database.
Simplest implementation I can think of is with a Nest model, then add a ForeignKey to Animal so that birds can be added or removed from a nest. The Nest model itself would have a location, a name, and an egg count. But this would only hold the current state of the nest, whereas we want to keep a record. Among other reasons, having a date when eggs are laid would allow predicting when they will hatch.
We already keep records in the form of Event objects, but these are linked to animals and locations, so it wouldn't be trivial to make them work for a separate model. Thus, another option is to extend the Location model so that it can be used as a nest. Eggs probably have to be tracked as unique objects, whether as weird Animal instances or using their own somewhat simpler model. In this approach, a lot of the logic would be in the views.
The problem I see here is that Animals don't have a unique Location; instead, this is inferred by joining to the Event table and finding the most recent event. This works nicely for 90% of the logic, but it's not simple to go in the reverse direction, from Location to Animal, at least not with the Django ORM.
The admin interface says the parent fields are required, but the model should allow them to be blank.
Egg counts can be somewhat fluid and it's a giant pain in the butt to delete the eggs manually. Thanks
It would be nice if the age of birds stopped counting up after they were marked as no longer alive. That would be handy for verifying the ages of birds used in experiments.
It would be nice to be able to query the database for all the birds or a subset of birds at a particular location (e.g. all living, male birds in room xxx)
Would also be useful to have an indication of which days have had a nest check
counts of various events (births, deaths) in a month
counts of animals at various ages right now
Looking up which age group an animal belongs to requires a join on the Age table via Species. This is pretty quick but some views require it to be done for a lot of animals - all the living birds or all the birds in nests.
One solution would be to annotate the animal query with the age and age group, instead of the current implementation as object-level methods. This would need to be optional as queries to count children don't need the annotation (see #31).
Another possibility would be to cache Species x Age. This would have a fairly small number of rows and would usually not change at all after initial database setup. This wouldn't help the age lookup itself (which requires Animal x Event) but would probably speed the age-group lookup even more than an annotation.
This is bad for obvious reasons.
Might be nice to have to explicitly say that there were no changes to a nest. That way, if you don't mark "no changes" but there are eggs in that nest, the page can warn you that you forgot to check a box.
This is all cosmetic so low priority but would be good to:
The current reservation system is pretty clunky. It requires using the admin interface, and there's no record of when the reservation was created. Sometimes users forget to release the reservation, so there are birds that get reserved, and then it's not clear if the reservation is no longer needed.
The general idea would be to create a Reservation model that tracks creation date. It could also include optional expiration and comment fields.
The default manager for this class annotates queries with an 'alive' field that's calculated by summing "adds" vs "removes" over the events associated with the animal. This field is used in a lot of views, but it's not needed to for example count the number of children (including the number of living and unhatched, as that can be done with a simple exclude or filter on the status.
I think this annotation is costing a lot for some views because a children query gets called for every animal in a list. It affects not just the top-level lists of animals but also the list of children shown for views of individual animals.
I'm actually a little surprised that the annotation comes through on a related object query. But the SQL queries suggest that the children queries are getting hit a lot.
I'm not sure the best way to solve this, because the "alive" annotation is needed whenever we do a list of birds. It just doesn't need to be known when we look up the number of children. Maybe a separate method to do the child counts on unannotated queries. Alternatively, calculate these numbers in the database. Essentially every animal view requires joins against the event table, both directly and via its children and/or parents.
The "children" field in the bird tables gives a count of the number of children the bird has, but this includes unhatched eggs, which makes it less useful in determining if a bird has descendants.
In a lab setting, it would be useful to have the option of broadcasting a message to a slack channel when a user completes a nest check.
It would be great if the Eggs and Progeny list did not show eggs that had been lost, and if the count of eggs on the list of pairings did not reflect lost eggs as well.
Bird status information is not getting annotated correctly - birds are showing up as alive in the genealogy when they are not.
Currently, entering sex information for a bird requires using the admin interface. Typically the user creates a note as well. A form could streamline this.
It would be useful to be able to display the age of the oldest chick for active breeding pairs. This would avoid the need to look at the detail view to make plans around when birds will reach a certain age.
Age is a fairly complicated calculation, however, that currently involves a lot of python code, so it might be slow to compute for more than a few pairings.
various places where dicts are being used, resulting in unpredictable sorting:
Just noting the issue here so I don't forget to come back to it later. Probably just need to get the right annotations.
It should be possible to associate data files with birds so that users can browse and query by available data. The data itself would not be stored in django, just a canonical identifier that would be used to retrieve the file through some other interface (e.g., neurobank).
It may make sense to store some additional fields, like the type of data (neural or acoustic) and timestamp. These would be duplicates of the canonical data, but would allow many basic queries to be made through django.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.