federated-model-aggregation icon indicating copy to clipboard operation
federated-model-aggregation copied to clipboard

Need a TypeScript client with the same API as the python client

Open JGSweets opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Currently, there's only a python client.

Describe the outcome you'd like: Similar to the python client here: https://github.com/capitalone/federated-model-aggregation/tree/main/clients

We need a typescript client that similarly interacts with the API.

Additional context: Mimic the API schema from the python client. Folder structure, etc.

Contributor is able to take liberties from the below.

These are suggested solutions.

Each function can be broken into a separate PR and unit tests created for each.

In a file called settings.ts:

export class DefaultSettings {
    url: string;
    constructor(){
        this.url = "http://127.0.0.1:8000/";
    }
}

In a file called clients.ts:

export class WebClient {
    /**
    *REST API Wrapper to interact with the federated model aggregation service.
    **/
    private _url: string;
    private _uuid: any;
    private _federated_model_id: number;
    is_registered: boolean;
    last_model_aggregate: number | null;
    constructor(federated_model_id:number, uuid:any=null, url:any=null) {
    ...
    }

    private _get_auth_header(uuid=null){...}
    async register() {...}
    async send_update(data:any, base_aggregate=null){...}
    
    async check_for_new_model_aggregate(update_after=null){...}
    async get_current_artifact(){...}
    async check_for_latest_model(update_after=null){...}
    async send_val_results ...
    
    ...
}

JGSweets avatar Jul 06 '23 21:07 JGSweets

PR with tests for:

  • [x] Initialize TS client folder
  • [ ] update workflow to run tests in this new folder
  • [ ] settings.ts
  • [ ] Webclient constructor
  • [ ] _get_auth_header
  • [ ] register
  • [ ] send_update
  • [ ] check_for_new_model_aggregate
  • [ ] get_current_artifact
  • [ ] check_for_latest_model
  • [ ] send_val_results
  • [ ] Example using TS client

Please add more comments as we need to break further.

JGSweets avatar Jul 06 '23 22:07 JGSweets