Comments (8)
And/Or some similar useful APIs, yes, that'd be elegant. contains
might be a good one too.
Perhaps this is a good opportunity to implement a chainable filter on TagGroup which could work like a list except with extra methods to filter further - so you could go, for example:
<thing>.getTags.startswith('meta').contains('sys2').subTags()[-1]
which, if applied to a Taggable
with tags="tag1 tag2 meta:sys1:1234 meta:sys2:3456"
would result in 3456
.
from octue-sdk-python.
@thclark I've implemented chained filtering 💯 Isn't the proposed
has
method the same as__contains__
?
It certainly can be, but I don't know whether we want to use __contains__
for that. Probably don't want to overload such an important method in a mixin.
For example, a Dataset
is a Taggable
but you'd want to reserve __contains__
for much more obvious uses like if <DataFile> in Dataset
.
from octue-sdk-python.
@time-trader you might want to follow this
from octue-sdk-python.
@thclark do you want the startswith
etc methods to be able to work on subtags too? Or just be able to get subtags from a TagGroup
?
from octue-sdk-python.
The other side of the problem is needing to be able to test against tags, for searching matching files in a manifest.
This is where we really should be using a search index and lucene syntax, which we could do trivially if this were online-only. But there aren't any native python implementations (everything requires a JVM, and I foresee trouble ahead with that...), and being able to do it locally would be helpful.
But, we could implement a has
method on the taggable class that returns T/F given the filters above.
That'd allow us to implement a match_files()
method on a a Dataset which would implement a crude O(MN) search (M = no. tags, N = no. files) for files meeting those criteria.
from octue-sdk-python.
@thclark I've implemented chained filtering 💯 Isn't the proposed has
method the same as __contains__
?
from octue-sdk-python.
Maybe we use something more descriptive though, like has_tag
or has_tags
from octue-sdk-python.
I've swapped __contains__
for has_tag
but I've just realised that it doesn't matter if we have loads of magic methods for TagGroup
as it's not a mixin - its instances are used as an attribute of a mixin.
from octue-sdk-python.
Related Issues (20)
- Improve support for asynchronous questions
- Update child emulator to work with new event structure
- Add/update attributes in event schema HOT 10
- Allow `.yml` extension for `octue.yaml` file HOT 1
- Test PyPI package publishing not working
- Update licence year to 2024
- Switch to single-topic-per-workspace services
- Profile with python3.11 and use for testing HOT 1
- Remove the `datetime` field from `delivery_acknowledgement` and `heartbeat` events
- Optimise clustering of event store
- Make bigquery-related dependencies optional
- Return question UUID from `Child.ask`
- Return deserialised manifests from `get_events` function
- Use service account for event handler cloud function
- Make Question chains easily extractible from BigQuery Event Store
- Download manifests' datasets to same temporary directory by default
- Update from deprecated `utcnow` method
- Update `project_name` to `project_id`
- Add ability to run callback function on answers when using `Child.ask_multiple`
- Allow specifying project name by environment variable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octue-sdk-python.