# SKA SRC Software Discovery API Science-ready software catalog that registers and discovers metadata for SKA software containers. Delivered as a FastAPI microservice with PostgreSQL persistence, Alembic migrations, and Helm packaging. ## Features - **Youcat integration** — Integration with Youcat for fetching software metadata. - **Software Registration** — Register new software metadata via `POST /v1/software`. - **Software Modification** — Update existing entries with `PUT /v1/software/{software_id}`. - **Health Monitoring** — `/v1/health` reports uptime, request count, and dependent service status. ## API Endpoints ### Health Check ```http GET /v1/health ``` Returns uptime, request count, and status of dependent services. ### Register Software ```http POST /v1/software Authorization: Bearer Content-Type: application/json ``` Request Body: ```json { "software_id": "my-software-v1", "name": "Example Pipeline", "description": "A reference pipeline for radio astronomy data processing.", "discovery": { "science_category": ["radio astronomy"], "function_category": ["calibration"], "science_working_group": ["continuum imaging"], "tools_included": ["wsclean", "aoflagger"] }, "versions": [ { "version": "1.0.0", "release_date": "2024-01-15T00:00:00Z", "changelog": "Initial release.", "data_compatibility": { "data_input_type": ["measurement_set"], "data_output_type": ["fits"] }, "resources": { "requires_gpu": false, "supported_modes": ["batch", "interactive"], "min_memory_gb": 8, "recommended_memory_gb": 16 }, "executables": [ { "type": "docker", "location": "images.canfar.net/skao/pipeline:1.0.0", "cpu_architecture": ["x86_64"], "digest": "sha256:abcd1234..." } ], "provenance": { "repository_url": "https://github.com/skao/pipeline", "registered_by": "user@example.com", "registration_date": "2024-01-15T10:00:00Z" } } ] } ``` Response: ```json { "id": "651d7968ebc02f9f2d66b3df", "name": "Example Pipeline", "version": "1.0.0", "description": "A reference pipeline for radio astronomy data processing.", "created_at": "2024-01-15T10:00:00.123456" } ``` ### Modify Software ```http PUT /v1/software/{software_id} Authorization: Bearer Content-Type: application/json ``` Request Body: (same structure as POST /v1/software) Response: ```json { "id": "651d7968ebc02f9f2d66b3df", "name": "Example Pipeline", "version": "1.1.0", "description": "Updated pipeline with new features.", "updated_at": "2024-02-01T12:00:00.123456" } ``` ## Repository Structure - `src/` - Main application code including API routes, models, and services. - `alembic/` - Database migration scripts. - `charts/` - Helm charts for deploying the service. - `tests/` - Unit and integration tests. - `etc/` - Configuration files. - `images/` - Dockerfile and related container files. ## Getting Started ### Prerequisites - Python 3.13+ - PostgreSQL 12+ - Docker (for containerization) - Helm (for deployment) ### Installation 1. Clone the repository: ```bash git clone https://gitlab.com/ska-telescope/src/src-mm/ska-src-mm-software-discovery.git cd ska-src-mm-software-discovery/helm/etc ``` 2. Update configuration files in `etc/helm/values` as needed. 3. Deploy using Helm: ```bash helm install ska-src-software-discovery ./ska-src-software-discovery ``` #### Running Locally 1. Update .env file with database and other configurations. 2. Run docker-compose:``` ```bash docker-compose up --build ``` 3. Exec into the container and run migrations: ```bash docker exec -it sdapi-core bash alembic upgrade head ``` 4. Access the youcat API at `http://localhost:8080`. 5. Access the software discovery API at `http://localhost:8080/v1`.