Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
MAT-7775: add data element code for birthdatee (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
chubert-sb authored Oct 15, 2024
1 parent 79c7aa2 commit 3ef44d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const DemographicsSection = ({ canEdit }) => {
const { state, dispatch } = useQdmPatient();
const { patient } = state;
// this will be local
const [birthDateDataElement, setBirthDateDataElement] =
useState<DataElement>();
const [raceDataElement, setRaceDataElement] = useState<DataElement>();
const [genderDataElement, setGenderDataElement] = useState<DataElement>();
const [ethnicityDataElement, setEthnicityDataElement] =
Expand Down Expand Up @@ -186,12 +188,19 @@ const DemographicsSection = ({ canEdit }) => {
const formatted = dayjs.utc(val).format();
const existingElement = getDataElementByStatus("birthdate", patient);
const newTimeElement = getBirthDateElement(formatted, existingElement);
dispatch({
type: existingElement
? PatientActionType.MODIFY_DATA_ELEMENT
: PatientActionType.ADD_DATA_ELEMENT,
payload: newTimeElement,
});
if (val) {
dispatch({
type: existingElement
? PatientActionType.MODIFY_DATA_ELEMENT
: PatientActionType.ADD_DATA_ELEMENT,
payload: newTimeElement,
});
} else {
dispatch({
type: PatientActionType.REMOVE_DATA_ELEMENT,
payload: existingElement,
});
}
dispatch({
type: PatientActionType.SET_BIRTHDATETIME,
payload: val,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export interface CodeSystem {
system: string;
}

export const BIRTHDATE_CODE: DataElementCode = {
code: "21112-8",
system: "2.16.840.1.113883.6.1",
version: undefined,
display: "Birth date",
};

export const RACE_CODE_OPTIONS: DataElementCode[] = [
{
code: "1002-5",
Expand Down Expand Up @@ -95,6 +102,7 @@ export const getBirthDateElement = (
? new PatientCharacteristicBirthdate(existingElement)
: new PatientCharacteristicBirthdate();
pcb.birthDatetime = value;
pcb.dataElementCodes = [BIRTHDATE_CODE];
return pcb;
};

Expand Down

0 comments on commit 3ef44d5

Please sign in to comment.