To make it easier on having to fill this out each time, you may do this in your code:
// Make this a constant in your application.
const MSH_HEADER: HL7_2_8_MSH = {
msh_9_1: "ADT",
msh_9_2: "A01",
msh_11_1: "D",
}
MSH.7 (Date Time) and MSH.12 (HL7 Spec) are filled in automatically at the time of creation. and when you create your Message class:
const message = new Message({ ...MSH_HEADER, msh_10: 'unique id' })
so this way your code is much neater.
HL7 2.8 MSH Specification