Is there a preferred way to have a downstream table that can take data from one of two upstream tables in datajoint?

418 views Asked by At

We are trying to build flexible schema where, for example, we might have single units that come from one of two places, either a SpikeSorting pipeline that begins from raw data, or imported from a file where spike sorting has already been done.

We'd like to be able to feed the data from whichever of those tables is relevant into the same analysis functions / tables downstream.

We have considered making the SpikeSorting table a hybrid of computed and imported entries, but that seems a bit ugly. Is there a better way?

1

There are 1 answers

0
Chris On

For this particular case (varying ingest), I'd probably create an upstream dj.Imported table representing the state of ingest from the different sources, containing something like the session and the source path. The make logic would take care of determining the source type and loading the data into the real SpikeData (or whatever name) table, and mark the source type as a flag there, either as a direct value or a foreign key into some kind of 'tag' table.

The same "upstream disambiguation table and tags/flags into a downstream" kind of approach works more generically in other situations, or, depending on the case, just store the data in the combining table directly.