Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial model card and schema routes #692

Merged
merged 10 commits into from
Sep 5, 2023
Merged

Conversation

a3957273
Copy link
Member

This adds routes for:

  • Get a model card (either the latest, or a specific version).
  • Initialize a blank model card from a schema.
  • Update a model card.

export interface ModelCardInterface {
schemaId: string
version: number
createdBy: string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be just the username or is it worth adding in the full entity object?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should always use users whenever it's an action done by someone. There's never a 'group' that creates a release, it's always a specific person. (Also, entities are now strings of the form ${type}:${id}).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry I forgot the change in entity format, yeah I agree with this in that case.


version: 1,
metadata: { example: true },
console.log('CARD', card)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this added during development or do we need to log this

Copy link
Member Author

@a3957273 a3957273 Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. I had some issues mocking and fell back to some console logging that I clearly forgot to remove. Nice catch!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do it all the time :D


version: 1,
metadata: { example: true },
if (!card) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this logic not in the service?

} as const
export type GetModelCardVersionOptionsKeys =
(typeof GetModelCardVersionOptions)[keyof typeof GetModelCardVersionOptions]
export async function getModelCard(user: UserDoc, modelId: string, version: number | GetModelCardVersionOptionsKeys) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we agreed not to use http methods in service names? Should this be f'indModelCardByModelId'?

@@ -2,19 +2,16 @@ import bodyParser from 'body-parser'
import { Request, Response } from 'express'
import { z } from 'zod'

import { ModelCardInterface } from '../../../../models/v2/ModelCard.js'
import { ModelCardInterface } from '../../../../models/v2/Model.js'
import { getModelCard as getModelCardService, GetModelCardVersionOptions } from '../../../../services/v2/model.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you renaming this method? See previous comment about using http methods in service method names

@ARADDCC002 ARADDCC002 merged commit 1ff69eb into main Sep 5, 2023
@a3957273 a3957273 deleted the feature/rest-model-card branch September 8, 2023 23:35
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.

3 participants