tator icon indicating copy to clipboard operation
tator copied to clipboard

String array attribute type

Open jrtcppv opened this issue 3 years ago • 5 comments

Add a new attribute type string_array that will allow for things like "tags" and use a front end widget that populates an area with pills. Autocomplete should be supported. In PSQL they will simply be part of the JSON attributes, in elasticsearch the items will be indexed as keywords. Migration to different data types will not be supported initially.

jrtcppv avatar Aug 06 '21 19:08 jrtcppv

One thing to think about here is whether it is better to PATCH an object with the full array or to have some kind of append/remove methods, tentatively leaning toward the former.

jrtcppv avatar Aug 06 '21 19:08 jrtcppv

In an ES-less world another implementation path is something like the following:

-Add a new JSONB field (one could piggy back off attributes, but that might be messy).

  • In the DB for a record, a tag of 'Really Cool' would be applied in the that field as so: {'tags': {'Really Cool': true}}
  • You could then search on those tags via the ORM by looking for Object.filter(tags__really_cool__isnull=False) # or tags__really_cool = True
  • If they were needed one could also index them with a BTREE index

bctcvai avatar Dec 20 '22 13:12 bctcvai

Searching on tags, I could see anyOf and allOf being operations added to AttributeOperationSpec in object_search

bctcvai avatar Dec 20 '22 13:12 bctcvai

The comments above relate to 'filtering tags' which are akin to tags in github. E.g. being able to search on bugs vs. feature requests.

bctcvai avatar Dec 20 '22 16:12 bctcvai

Also of note, its possible doing a list of strings with a TGRM-based index is also effecvtive here. Would require some prototype whether key/val in an object on btree is better.

Of note, in the example above the lack of a tag in the tags object means the tag is not applied, so a literal false is not required for all possible tags.

bctcvai avatar Dec 20 '22 17:12 bctcvai