Skip to content

Comments

Phase 2: Use register_dataset for all datasets including built-ins#51

Merged
jefferis merged 3 commits intomasterfrom
feature/phase2-register-dataset
Feb 9, 2026
Merged

Phase 2: Use register_dataset for all datasets including built-ins#51
jefferis merged 3 commits intomasterfrom
feature/phase2-register-dataset

Conversation

@jefferis
Copy link
Contributor

@jefferis jefferis commented Feb 6, 2026

Summary

Depends on: #50 (Phase 1)

This PR establishes a uniform registration mechanism for all datasets (builtin and external) using coconat::register_dataset.

New files for dataset-specific functions:

  • R/zzz.R: .onLoad() to register all built-in datasets
  • R/flywire.R: .flywire_ids, .flywire_meta, .flywire_partners
  • R/hemibrain.R: .hemibrain_ids, .hemibrain_meta, .hemibrain_partners
  • R/opticlobe.R: .opticlobe_ids, .opticlobe_meta, .opticlobe_partners
  • R/malecns.R: .malecns_ids, .malecns_meta, .malecns_partners
  • R/manc.R: .manc_ids, .manc_meta, .manc_partners
  • R/banc.R: .banc_ids, .banc_meta, banc_error, .banc_partners, banc_version
  • R/yakubavnc.R: .yakubavnc_ids, .yakubavnc_meta, .yakubavnc_partners

Updated R/fanc.R:

  • Renamed to .fanc_ids, .fanc_meta
  • Added fanc_version and .fanc_partners

Simplified dispatch functions:

  • get_id_fun: now uses only registered functions
  • get_meta_fun: now uses only registered functions
  • cf_partners: uses registered partnerfun instead of if-else chain
  • abbreviate_datasets: uses only registered shortnames
  • lengthen_datasets: uses only registered shortnames

Cleaned up:

  • R/meta.R: removed functions moved to dataset-specific files
  • R/partners.R: removed functions moved to dataset-specific files

All dataset-specific functions now use private naming convention (.prefix) for consistency.

Test plan

  • Verify cf_datasets('builtin') returns all 8 datasets
  • Verify abbreviate_datasets(cf_datasets('builtin')) works
  • Verify cf_ids(hemibrain=12345) works
  • Verify registered functions are accessible via coconat:::dataset_details()
  • Verify cf_meta and cf_partners work with all datasets

- Change cf_ids expand default to TRUE
- Add 'expanded' attribute to cidlist objects to track resolution state
- Add check_expanded() to verify IDs have been resolved before use
- cf_partners and cf_meta now check for expanded IDs instead of calling expand_ids
- c.cidlist checks inputs are expanded and propagates the attribute
- Remove redundant fanc_ids()/banc_ids() calls from .fanc_partners() and .banc_partners()

This ensures all query resolution happens in cf_ids, making it the single
entry point for ID resolution. Downstream functions receive only resolved
numeric IDs, preparing for Phase 3 local cache support.
- Create separate files for each dataset (flywire.R, hemibrain.R, etc.)
- Add R/zzz.R with .onLoad() to register all built-in datasets
- Simplify get_id_fun(), get_meta_fun() to use registered functions
- Simplify cf_partners() dispatch to use registered partnerfun
- Use registered shortnames in abbreviate_datasets()

Bug fixes:
- Fix fafbseg::.flywire_ids -> fafbseg::flywire_ids (exported function)
- Fix malevnc::.manc_ids -> malevnc::manc_ids (exported function)
- Fix fancorbanc_ids/meta function references in banc.R
- Fix fanc_meta/banc_meta -> .fanc_meta/.banc_meta in fancorbanc_ids
- Restore neuprint.chunksize parameter for neuprint-based datasets
- Add test helper register_rhubarb() with idfun for expanded ID tests
- Update test expectations for new expand=TRUE default
- Suppress expected warnings in tests to reduce CI noise
- Install malecns in R CMD check workflow
@jefferis jefferis force-pushed the feature/phase2-register-dataset branch from 05f4ae5 to 72ff404 Compare February 9, 2026 10:55
@jefferis jefferis changed the base branch from feature/phase1-cf-ids-resolver to master February 9, 2026 11:50
@jefferis jefferis merged commit 311e6b2 into master Feb 9, 2026
@jefferis jefferis deleted the feature/phase2-register-dataset branch February 9, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant