-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix(api): add stats to inbound lambda #2068
Conversation
@@ -70,7 +70,7 @@ export async function calculateDocumentConversionStatus({ | |||
}); | |||
|
|||
if (isConversionCompleted) { | |||
const startedAt = updatedPatient.data.documentQueryProgress?.startedAt; | |||
const startedAt = externalData?.documentQueryProgress?.startedAt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot about this but its affected by scheduling the DQ so need to get the HIE startAt
@@ -17,7 +17,9 @@ export type InboundDocumentQueryRespSuccessful = z.infer< | |||
typeof inboundDocumentQueryRespSuccessfulSchema | |||
>; | |||
|
|||
const inboundDocumentQueryRespFaultSchema = baseErrorResponseSchema; | |||
const inboundDocumentQueryRespFaultSchema = baseErrorResponseSchema.extend({ | |||
extrinsicObjectXmls: z.never().or(z.literal(undefined)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i dont set as never when erroringi cant extract from result when successful
const inboundDocumentRetrievalRespFaultSchema = baseErrorResponseSchema; | ||
const inboundDocumentRetrievalRespFaultSchema = baseErrorResponseSchema.extend({ | ||
documentReference: z.never().or(z.literal(undefined)), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Ref: #000 - [email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - [email protected] - @metriport/[email protected] - @metriport/[email protected] - [email protected]
Ref: #000 - [email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - [email protected] - @metriport/[email protected] - @metriport/[email protected] - [email protected]
static getPostHogApiKey(): string | undefined { | ||
return getEnvVar("POST_HOG_API_KEY"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to core
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it was moved to core, but we need to add code to the lambda to get the value from the env var and call the AWS SDK to get the value of the secret w/ the env var content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment, which is kind of a nit... Address at your discretion 😄
Also, would be good to release NPM packages after a PR is approved, so:
- there are no iterations on NPM releases in case a change is requested in a published package, and
- the pkg version updates don't litter the PR
static getPostHogApiKey(): string | undefined { | ||
return getEnvVar("POST_HOG_API_KEY"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it was moved to core, but we need to add code to the lambda to get the value from the env var and call the AWS SDK to get the value of the secret w/ the env var content.
Ref: #000 - [email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - @metriport/[email protected] - [email protected] - @metriport/[email protected] - @metriport/[email protected] - [email protected]
if (postHogSecretName) { | ||
postHogApiKey = await getSecretValue(postHogSecretName, region); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to call analytics if there's no API key?
packages/core/src/util/config.ts
Outdated
static getUseMockS3Utils(): boolean { | ||
return getEnvVar("USE_MOCK_S3_UTILS") === "true"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not part of this PR, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ill remove since its not being used anywere but seems like its already part of the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
seems like its already part of the code
FYI, that usually happens after a bad conflict resolution.
const posthog = new PostHog(postApiKey); | ||
export const analytics = (params: EventMessageV1, postApiKey?: string) => { | ||
const apiKey = postApiKey ?? defaultPostHogApiKey; | ||
if (apiKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since we're touching this, could make this return if no api key available, instead of having the main flow inside an if
NABD, though
Ref. metriport/metriport-internal#1669 Signed-off-by: Jorge Orta <[email protected]>
Ref. metriport/metriport-internal#1669
Ticket: #1889
Dependencies
Description
Add analytics to inbound to determine how often we respond with docs after Patient Match
Testing
Release Plan