Skip to content

Commit

Permalink
Merge pull request #29 from awell-health:patient-object
Browse files Browse the repository at this point in the history
feat(patient): support for patient profile
  • Loading branch information
bejoinka authored Aug 2, 2024
2 parents 70296c8 + 008ff59 commit 65a1a47
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
npm version patch
npm run bundle
new_version=v$(cat package.json | jq -r '.version')
git commit --amend -m "$new_version [skip ci]"
git commit --amend -m "$new_version [skip-ci]"
git push
git tag -a $new_version -m "ci: update tag: $new_version" && git push --tags
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
Expand Down
17 changes: 15 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/api/cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getOrchestrationClient
} from './client'
import { PathwayCaseConfig } from '../config'
import { CreatePatientInput } from '../gql/orchestration-types'

export type Activities =
| Awaited<
Expand Down Expand Up @@ -33,12 +34,16 @@ export const createCase = async (opts: {
return resp.createPathwayCase.pathway_case
}

export const createPatient = async (opts: { lastName: string }) => {
export const createPatient = async (opts?: CreatePatientInput) => {

Check warning on line 37 in src/api/cases.ts

View workflow job for this annotation

GitHub Actions / Tag and Release

Missing return type on function
const controller = new AbortController()
const client = getOrchestrationClient(controller)
const resp = await client.CreatePatient({
input: {
last_name: opts.lastName
...(opts?.first_name && { first_name: opts.first_name }),
...(opts?.last_name && { last_name: opts.last_name }),
...(opts?.birth_date && { birth_date: opts.birth_date }),
...(opts?.mobile_phone && { mobile_phone: opts.mobile_phone }),
...(opts?.email && { email: opts.email })
}
})
if (!resp.createPatient.success) {
Expand Down
9 changes: 9 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ const PathwayCaseConfigSchema = z.object({
value: b.value
}
})
}),
patient: z
.object({
first_name: z.string().optional(),
last_name: z.string().optional(),
birth_date: z.string().optional(),
mobile_phone: z.string().optional(),
email: z.string().optional()
})
.optional()
})

const ConfigSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion src/runner/runner-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class RunnerFactory {
config: PathwayCaseConfig
}): Promise<OrchestrationPathwayRunner | DesignPathwayRunner> {
if (this.e2e) {
const { id: caseId } = await createPatient({ lastName: config.title })
const { id: caseId } = await createPatient(config.patient)
const runner = new OrchestrationPathwayRunner({
caseId,
config,
Expand Down

0 comments on commit 65a1a47

Please sign in to comment.