Web platform for sharing free data for ML and research

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

More query options

roundabout,
created on Sunday, 15 September 2024, 07:48:11 (1726386491), received on Sunday, 15 September 2024, 08:03:33 (1726387413)
Author identity: vlad <vlad.muntoiu@gmail.com>

692c1ad7b111cd332fc7a0000cdf8e3f8b23b1b6

app.py

@@ -1170,7 +1170,15 @@ def get_picture_query(query_data):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    "after_date": lambda value: PictureResource.timestamp >= datetime.utcfromtimestamp(
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            value),
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    "in_gallery": lambda value: PictureResource.galleries.any(PictureInGallery.gallery_id.in_(value)),
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "above_rating": lambda value: db.select(db.func.coalesce(db.func.avg(PictureRating.rating), 5)).where(PictureRating.resource_id == PictureResource.id).scalar_subquery() >= value,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "below_rating": lambda value: db.select(db.func.coalesce(db.func.avg(PictureRating.rating), 0)).where(PictureRating.resource_id == PictureResource.id).scalar_subquery() <= value,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "above_rating_count": lambda value: db.select(db.func.count(PictureRating.id)).where(PictureRating.resource_id == PictureResource.id).correlate(PictureResource).scalar_subquery() >= value,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "below_rating_count": lambda value: db.select(db.func.count(PictureRating.id)).where(PictureRating.resource_id == PictureResource.id).correlate(PictureResource).scalar_subquery() <= value,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "above_region_count": lambda value: db.select(db.func.count(PictureRegion.id)).where(PictureRegion.resource_id == PictureResource.id).correlate(PictureResource).scalar_subquery() >= value,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "below_region_count": lambda value: db.select(db.func.count(PictureRegion.id)).where(PictureRegion.resource_id == PictureResource.id).correlate(PictureResource).scalar_subquery() <= value,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                "copied_from": lambda value: PictureResource.copied_from_id.in_(value),
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                if "want" in query_data:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    for i in query_data["want"]:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if len(i) != 1: