Skip to content

Add Affinities integration for automatic registration of datasets and services#64

Merged
rbardaji merged 6 commits intomainfrom
feature/affinities-integration
Feb 18, 2026
Merged

Add Affinities integration for automatic registration of datasets and services#64
rbardaji merged 6 commits intomainfrom
feature/affinities-integration

Conversation

@rbardaji
Copy link
Collaborator

Summary

Closes #63

Adds integration with NDP Affinities API to automatically register datasets, services, and their relationships when created in NDP-EP.

Changes

  • Configuration: New environment variables (AFFINITIES_ENABLED, AFFINITIES_URL, AFFINITIES_EP_UUID, AFFINITIES_TIMEOUT)
  • Client module: api/services/affinities_services/ with async HTTP client
  • Hooks: Automatic registration on POST /dataset and POST /services
  • Documentation: docs/affinities-integration.md
  • Tests: tests/test_affinities_client.py

Non-breaking

Integration is disabled by default (AFFINITIES_ENABLED=False) and non-blocking (errors logged but don't affect main operations).

Tested

  • ✅ Dataset registration in Affinities
  • ✅ Dataset-endpoint relationship created
  • ✅ Service registration in Affinities
  • ✅ Service-endpoint relationship created

Raul Bardaji added 6 commits February 18, 2026 19:40
- Add api/config/affinities_settings.py with:
  - AFFINITIES_ENABLED (default: False)
  - AFFINITIES_URL
  - AFFINITIES_EP_UUID
  - AFFINITIES_TIMEOUT (default: 30)
- Update example.env with new variables and documentation
- Create api/services/affinities_services/ package
- Add AffinitiesClient class with async methods:
  - register_dataset() - registers dataset + creates relationship
  - register_service() - registers service + creates relationship
  - create_dataset_endpoint_relationship()
  - create_service_endpoint_relationship()
- Error handling with logging (non-blocking)
- Global client instance: affinities_client
- Update post_general_dataset.py:
  - Import AffinitiesClient and logging
  - Register dataset in Affinities after creation (non-blocking)

- Update post_service.py:
  - Import AffinitiesClient and logging
  - Register service in Affinities after creation (non-blocking)

Both hooks are non-blocking: if Affinities fails, a warning is logged
but the main operation completes successfully.
- Create docs/affinities-integration.md with:
  - Overview of the integration
  - Configuration instructions
  - Setup steps (registering EP in Affinities)
  - How datasets and services are registered
  - Error handling behavior
  - Metadata format examples
  - Troubleshooting guide
- Create tests/test_affinities_client.py with tests for:
  - AffinitiesClient.is_enabled behavior
  - register_dataset success and error handling
  - register_service success and error handling
  - Settings configuration validation
@rbardaji rbardaji merged commit a305e12 into main Feb 18, 2026
1 check failed
@rbardaji rbardaji deleted the feature/affinities-integration branch February 18, 2026 18:41
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.

Add Affinities integration for automatic registration of datasets and services

1 participant