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

chore(metriport): temporarily remove metriport until api-sdk doesn't cause build errors #575

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

bejoinka
Copy link
Contributor

@bejoinka bejoinka commented Feb 3, 2025

No description provided.

Copy link

github-actions bot commented Feb 3, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Placeholder Types

The use of any for MetriportPatientCreate and an empty object schema for usStateSchema should be reviewed. These placeholders may lead to runtime issues if not replaced with proper types and validations.

// TODO: Remove these
type MetriportPatientCreate = any
const usStateSchema = z.object({})
Stubbed Functionality

The createMetriportApi function has been stubbed to return an empty object cast as any. This should be reviewed to ensure it does not cause issues in dependent code.

): any => {
  return {} as any

Copy link

github-actions bot commented Feb 3, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
General
Replace any with a specific type

Replace the any type for MetriportPatientCreate with a more specific type to ensure
type safety and prevent runtime errors.

extensions/metriport/actions/patient/create.ts [18]

-type MetriportPatientCreate = any
+type MetriportPatientCreate = {
+  firstName: string;
+  lastName: string;
+  dob: string;
+  genderAtBirth: string;
+  personalIdentifiers: Array<any>;
+  contact: {
+    phone: string;
+    email: string;
+  };
+};
Suggestion importance[1-10]: 8

Why: Replacing any with a specific type improves type safety and prevents runtime errors. The suggested type aligns well with the context of the code and enhances maintainability.

8
Replace any return type with specific type

Avoid returning any in createMetriportApi by defining and returning a more specific
type or interface for the API object.

extensions/metriport/client.ts [7-8]

-): any => {
-  return {} as any
+): { apiKey: string; baseUrl: string } => {
+  return { apiKey: '', baseUrl: '' };
 }
Suggestion importance[1-10]: 8

Why: Replacing the any return type with a specific type enhances type safety and clarity, making the function's purpose and output more explicit. This change significantly improves code quality and maintainability.

8
Define a proper schema for usStateSchema

Ensure the usStateSchema object has a proper schema definition instead of being an
empty object to validate state data correctly.

extensions/metriport/actions/patient/create.ts [19]

-const usStateSchema = z.object({})
+const usStateSchema = z.object({
+  stateCode: z.string().length(2),
+  stateName: z.string(),
+});
Suggestion importance[1-10]: 7

Why: Providing a proper schema for usStateSchema ensures correct validation of state data, improving the reliability and robustness of the code. However, the exact schema definition may need further refinement based on actual requirements.

7
Specify type for id in callback

Specify the type of id in the find callback to avoid potential type mismatches and
improve code clarity.

extensions/metriport/actions/patient/get.ts [43]

-(id: any) => id.type === 'driversLicense',
+(id: { type: string }) => id.type === 'driversLicense',
Suggestion importance[1-10]: 6

Why: Specifying the type for id in the callback improves code clarity and reduces the risk of type mismatches. While beneficial, the improvement is relatively minor in scope.

6

@bejoinka bejoinka merged commit 6a2629c into main Feb 3, 2025
2 of 3 checks passed
@bejoinka bejoinka deleted the remove-metriport branch February 3, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant