List files with their metadata in one call

Aperta
#57 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
pandas, python
Ambito
data

Direzione di ricerca

Start by reading the client.datasets.list and watch implementations and the DatasetSource.list and watch methods; the issue does not name their file locations or tests. Check how dataset refs and metadata are returned, then see how the existing SANS example notebook uses them. Done means listings can include the requested metadata fields in each flat result while metadata(ref) remains available.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

client.files.list(selector) returns only file refs. Any listing that shows metadata, such as a form that lists sample runs with their titles, then reads each file's metadata with one call per file:

refs = client.files.list(Selector(role='sample'))
runs = [client.files.metadata(r)['run'] for r in refs]   # one call per file, full metadata each time

In-process this costs nothing. On the service each call is a round trip, and each returns the full metadata when the caller needs one field. Found while walking through a SANS example notebook.

Proposal. list and watch return, for each file, a flat dict of its ref and the metadata fields the caller names:

client.files.list(Selector(role='sample'), fields=('run', 'title'))
# [{'ref': FileRef(...), 'run': 60339, 'title': '...'}, ...]
  • Without fields, each entry holds the full metadata.
  • A flat dict goes straight into pd.DataFrame(...) or a GUI table, and the ref column feeds rows of a request.
  • metadata(ref) stays, for reading one file.
  • FileSource.list and watch change the same way, so a source backed by a catalogue such as SciCat can answer from its search result without further queries.

🤖 Generated with Claude Code

Lingua principale
Python
Stelle
0
Fork
1
Merge medio
9h 23m
PR unite (30g)
65

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scipp/essapps

Tutte le issue di scipp/essapps

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.