GithubHelp home page GithubHelp logo

Plumbing metadata about streamz HOT 8 OPEN

python-streamz avatar python-streamz commented on May 26, 2024
Plumbing metadata

from streamz.

Comments (8)

mrocklin avatar mrocklin commented on May 26, 2024

I will likely need something like this for time-series dataframes as well. I haven't thought very deeply about how to organize this yet. I may not do much thinking on this for the next couple weeks.

from streamz.

CJ-Wright avatar CJ-Wright commented on May 26, 2024

Great (to the need it as well)!

Another option is to include the metadata with the data and scrape the metadata off before doing the transformation and then putting it back on before emitting (but this seems a bit messier although this does offer up the option of combining data and metadata).

from streamz.

jrmlhermitte avatar jrmlhermitte commented on May 26, 2024

Sounds good. Sounds like there are two main ideas bounced around (correct me if I'm wrong):

  1. Metadata and data are packaged together in stream
  2. Data goes through stream, but metadata is kept in a separate place

I personally vote for the first. That's what we currently do with our streamdoc, which is basically a dictionary with args, kwargs and attributes elements (among other things). The parsing is done by a decorator which decorates each mapped function here. The application of this decorator is here (where this decorator is renamed to psdm). I apologize how messy it is but it is working for now. We're not completely settled on this idea.

I think handling all this is extremely messy from my perspective, and would suggest it not to be handled by the baseclass. Perhaps one could imagine making it a Mixin or something? (If possible) Just throwing ideas out there.

from streamz.

CJ-Wright avatar CJ-Wright commented on May 26, 2024

Hmm I didn't think of 2. I was thinking of having metadata-data-metadata-... and then having the streams nodes (potentially including the base class) behave differently for data and metadata.

from streamz.

jrmlhermitte avatar jrmlhermitte commented on May 26, 2024

PS: as an alternative to pandas, xarray could also be convenient. See here

from streamz.

CJ-Wright avatar CJ-Wright commented on May 26, 2024

One interesting side effect of this would be that we could potentially use this to manage our exceptions as well. We could:

  1. Create a blacklist of types which operators (map, filter, accumulate, etc.) just ignore and include the metadata and exception classes in this list.
  2. Upon exception turn the data into metadata (with a whole bunch of info on why/how/when it failed) now all the operators ignore the bad data.

One nasty side effect of this is that we need to make sure that we don't pair data and metadata together in the joining nodes (zip, zip_latest, combine_latest) as the operators would be confused.

from streamz.

jrmlhermitte avatar jrmlhermitte commented on May 26, 2024

It sounds like this is trending toward a heterogeneous stream of data. I would argue that this may be out of scope of streamz and may add more complexity that is not well understood yet (not enough use cases). Sounds like shed attempts to answer that. (Schematic here )

One thing I think could be useful here is multichannel streams. Something like data.data would be the regular channel passed on to the stream and data.md or data.anything could be other channels. But one could argue this can be accomplished with a different data type and function handling it properly (like xarray). I would disagree with putting multichannel streams in base class as well.

from streamz.

CJ-Wright avatar CJ-Wright commented on May 26, 2024

I think this has been handled some by #306 adding timestamp metadata could be done by the source. Another potential iteration would be to have metadata functions that return dicts and are passed in whatever data/metadata is applicable into the node, generating new metadata on the way out.

from streamz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.