Skip to content

Commit

Permalink
SQUASH eid after patient
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Jan 6, 2025
1 parent 713b053 commit 6b605e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions imports/api/patients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
type PatientTagFields,
patientSex,
patientIdFields,
PatientIdFields,
} from './collection/patients';

import {PatientsSearchIndex} from './collection/patients/search';
Expand Down Expand Up @@ -50,6 +51,7 @@ import {
} from './update';
import {type DocumentUpdate} from './DocumentUpdate';
import { EidFields } from './collection/eids';
import removeUndefined from '../lib/object/removeUndefined';

const splitNames = (string: string) => {
const [firstname, ...middlenames] = names(string);
Expand Down Expand Up @@ -391,7 +393,7 @@ export const patientFieldsFromEid = ({
photo,
dateofbirth
}
}: EidFields) => patientIdFields.parse({
}: EidFields): PatientIdFields => removeUndefined(patientIdFields.parse({
niss: nationalnumber,
firstname,
lastname: name,
Expand All @@ -401,7 +403,7 @@ export const patientFieldsFromEid = ({
: `${dateofbirth.slice(0, 4)}-${dateofbirth.slice(4, 6)}-${dateofbirth.slice(6, 8)}`,
sex: gender,
...address,
});
}));

export const patients = {
updateIndex,
Expand Down

0 comments on commit 6b605e5

Please sign in to comment.