### Initialize QBP_Q15 Segments Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_281.verified.txt Sets up the standard segments for the QBP_Q15 message, including MSH, SFT, UAC, QPD, Hxx, RCP, and DSC. Handles potential HL7 exceptions during setup. ```csharp /// /// initialize method for QBP_Q15. This does the segment setup for the message. /// private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(SFT), false, true); this.add(typeof(UAC), false, false); this.add(typeof(QPD), true, false); this.add(typeof(Hxx), false, false); this.add(typeof(RCP), true, false); this.add(typeof(DSC), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating QBP_Q15 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Field Example (Generic) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_25.verified.txt Example of getting a field value, likely for a field not explicitly detailed elsewhere. Handles HL7 and general exceptions. ```csharp { EI ret = null; try { IType t = this.GetField(12, 0); ret = (EI)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } ``` -------------------------------- ### PPP_PCB Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_251.verified.txt Internal method to set up the segments for the PPP_PCB message. ```csharp private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(SFT), false, true); this.add(typeof(PID), true, false); this.add(typeof(PPP_PCB_PATIENT_VISIT), false, false); this.add(typeof(PPP_PCB_PATHWAY), true, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPP_PCB - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Start Date Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_23.verified.txt Retrieves the Start Date (NK1-8). ```APIDOC ## GET /nhapinet/nhapi/startdate ### Description Retrieves the Start Date (NK1-8). ### Method GET ### Endpoint /nhapinet/nhapi/startdate ### Parameters None ### Request Example None ### Response #### Success Response (200) - **DT** - The DT object representing the start date. #### Response Example ```json "2023-10-27" ``` ``` -------------------------------- ### Get Start Date/Time Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_28.verified.txt Retrieves the Start Date/Time (AIS-4) field. ```APIDOC ## GET /ais/start-datetime ### Description Returns the Start Date/Time (AIS-4) value from the AIS segment. ### Method GET ### Endpoint `/ais/start-datetime` ### Parameters None ### Request Body None ### Response #### Success Response (200) - **StartDateTime** (DTM) - The Start Date/Time value. #### Response Example ```json { "StartDateTime": "20230101103000" } ``` ``` -------------------------------- ### OPL_O37 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_271.verified.txt Sets up the segments for the OPL_O37 message. ```csharp this.add(typeof(MSH), true, false); this.add(typeof(SFT), false, true); this.add(typeof(UAC), false, false); this.add(typeof(NTE), false, true); this.add(typeof(PRT), true, true); ``` -------------------------------- ### QBP_Z73 Initialization Logic Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_251.verified.txt Sets up the segments for the QBP_Z73 message. It adds MSH, SFT (optional, repeating), QPD, and RCP segments. ```csharp private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(SFT), false, true); this.add(typeof(QPD), true, false); this.add(typeof(RCP), true, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating QBP_Z73 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Start Date Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_26.verified.txt Retrieves the Start Date associated with the contact. ```APIDOC ## StartDate ### Description Retrieves the Start Date (NK1-8) associated with the contact. ### Method GET ### Endpoint /nhapinet/nhapi ### Response #### Success Response (200) - **DT** - The Start Date object. #### Response Example ```json { "example": "DT_object" } ``` ``` -------------------------------- ### Initialize RSP_K31_ORDER_DETAIL Structure Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_25.verified.txt Constructor for RSP_K31_ORDER_DETAIL, adding expected sub-structures. ```csharp public RSP_K31_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(RXO), true, false); this.add(typeof(NTE), false, true); this.add(typeof(RXR), true, true); this.add(typeof(RSP_K31_COMPONENTS), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RSP_K31_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Start Date/Time (AIL-6) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_25.verified.txt Retrieves the Start Date/Time (AIL-6). ```APIDOC ## GET /nhapinet/nhapi/start-datetime ### Description Retrieves the Start Date/Time (AIL-6). ### Method GET ### Endpoint /nhapinet/nhapi/start-datetime ### Response #### Success Response (200) - **TS** (TS) - The Start Date/Time object. #### Response Example ```json { "example": "TS object representation" } ``` ``` -------------------------------- ### Get Start Date/Time Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_251.verified.txt Retrieves the Start date/time (TQ1-7) from an HL7 message. ```APIDOC ## GET /nhapinet/nhapi/startdatetime ### Description Retrieves the Start date/time (TQ1-7). ### Method GET ### Endpoint /nhapinet/nhapi/startdatetime ### Parameters None ### Request Body None ### Response #### Success Response (200) - **TS** (TS object) - The TS object representing the Start date/time. #### Response Example ```json { "time": "20230101100000" } ``` ``` -------------------------------- ### RSP_O34 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_28.verified.txt Sets up the segments for the RSP_O34 message. ```csharp private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(SFT), false, true); this.add(typeof(UAC), false, false); this.add(typeof(MSA), true, false); this.add(typeof(ERR), false, false); this.add(typeof(QAK), true, false); this.add(typeof(QPD), true, false); this.add(typeof(RSP_O34_DONOR), false, false); this.add(typeof(RSP_O34_DONATION), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RSP_O34 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### QRY_Q01 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_251.verified.txt Internal method to set up the segments for the QRY_Q01 message. It defines which segments are present, their cardinality, and whether they are repeating. ```csharp private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(SFT), false, true); this.add(typeof(QRD), true, false); this.add(typeof(QRF), false, false); this.add(typeof(DSC), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating QRY_Q01 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Disability Start Date Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_23.verified.txt Retrieves the Disability start date (DB1-5). ```APIDOC ## DisabilityStartDate ### Description Returns Disability start date (DB1-5). ### Method GET ### Endpoint /nhapinet/nhapi/disabilityStartDate ### Response #### Success Response (200) - **DT** (DT) - The Disability start date. #### Response Example ```json { "date": "2023-01-01" } ``` ``` -------------------------------- ### Get First SUR_P09_PRODUCT Structure Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/SourceGenerationTests.Test_Generate_Versions_version=2.3.1.verified.txt Retrieves the first instance of the SUR_P09_PRODUCT structure. It is created if it does not already exist. ```csharp public SUR_P09_PRODUCT GetPRODUCT() { SUR_P09_PRODUCT ret = null; try { ret = (SUR_P09_PRODUCT)this.GetStructure("PRODUCT"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error occurred",e); } return ret; } ``` -------------------------------- ### Get Start Date/Time Offset (AIL-7) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_25.verified.txt Retrieves the Start Date/Time Offset (AIL-7). ```APIDOC ## GET /nhapinet/nhapi/start-datetime-offset ### Description Retrieves the Start Date/Time Offset (AIL-7). ### Method GET ### Endpoint /nhapinet/nhapi/start-datetime-offset ### Response #### Success Response (200) - **NM** (NM) - The Start Date/Time Offset object. #### Response Example ```json { "example": "NM object representation" } ``` ``` -------------------------------- ### DSR_Q03 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_22.verified.txt Internal method to set up the segments for the DSR_Q03 message. ```csharp private void init(IModelClassFactory factory) { this.add(typeof(MSH), true, false); this.add(typeof(MSA), false, false); this.add(typeof(QRD), true, false); this.add(typeof(QRF), false, false); this.add(typeof(DSP), true, true); this.add(typeof(DSC), false, false); ``` -------------------------------- ### Get Statistics Start Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_23.verified.txt Retrieves the Statistics Start (NST-4) field. This property is of type TS. ```csharp public TS StatisticsStart { get{ TS ret = null; try { IType t = this.GetField(4, 0); ret = (TS)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ``` -------------------------------- ### Initialize PPG_PCG_ORDER_DETAIL Structure Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_26.verified.txt Constructor for PPG_PCG_ORDER_DETAIL. Adds expected HL7 structures like OBR, Hxx, NTE, VAR, and PPG_PCG_ORDER_OBSERVATION. Catches HL7Exceptions during initialization. ```csharp public PPG_PCG_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(OBR), true, false); this.add(typeof(Hxx), true, false); this.add(typeof(NTE), false, true); this.add(typeof(VAR), false, true); this.add(typeof(PPG_PCG_ORDER_OBSERVATION), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPG_PCG_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### RSP_Z86_ORDER_DETAIL Constructor and Initialization Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_251.verified.txt This snippet shows the constructor for RSP_Z86_ORDER_DETAIL and how it initializes its child structures (RXO, RXR, RXC). ```APIDOC ## RSP_Z86_ORDER_DETAIL Constructor ### Description Initializes a new instance of the `RSP_Z86_ORDER_DETAIL` class, adding the necessary child structures. ### Method Constructor ### Endpoint N/A (Class constructor) ### Parameters - **parent** (IGroup) - The parent group. - **factory** (IModelClassFactory) - The factory to create model classes. ### Request Body N/A ### Response N/A ### Error Handling Logs HL7 exceptions during initialization. ``` -------------------------------- ### Get Field Example Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_281.verified.txt Example of retrieving a field value with error handling for HL7Exception and System.Exception. ```csharp CWE ret = null; try { IType t = this.GetField(2, 0); ret = (CWE)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ``` -------------------------------- ### OSU_O51 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_281.verified.txt Internal method to set up the segments for the OSU_O51 message. ```csharp private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(MSA), true, false); this.add(typeof(ERR), false, true); this.add(typeof(SFT), false, true); this.add(typeof(UAC), false, false); this.add(typeof(NTE), false, true); this.add(typeof(PID), false, false); this.add(typeof(ARV), false, true); this.add(typeof(OSU_O51_ORDER_STATUS), true, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating OSU_O51 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get All Requested Start Date/Time Ranges (ARQ-11) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_231.verified.txt Retrieves all repetitions of the Requested Start Date/Time Range. ```APIDOC ## GetRequestedStartDateTimeRange ### Description Retrieves all repetitions of Requested Start Date/Time Range (ARQ-11). ### Method GET ### Endpoint /nhapinet/nhapi ### Response #### Success Response (200) - **DR[]** (DR[]) - An array of DR objects representing all repetitions. #### Response Example ```json { "example": "[DR object1, DR object2, ...]" } ``` ``` -------------------------------- ### Get Employment Start Date (DT) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_23.verified.txt Retrieves the Employment Start Date (DT) from the data structure. ```APIDOC ## GET /nhapinet/nhapi/employmentstartdate ### Description Retrieves the Employment Start Date (DT) from IN2-44. ### Method GET ### Endpoint /nhapinet/nhapi/employmentstartdate ### Parameters None ### Request Example None ### Response #### Success Response (200) - **DT** (DT) - The Employment Start Date object. #### Response Example ```json { "employmentStartDate": "2023-01-01" } ``` ``` -------------------------------- ### RPI_I01 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_23.verified.txt Internal method to set up the segments for the RPI_I01 message structure. ```csharp /// /// initialize method for RPI_I01. This does the segment setup for the message. /// private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(MSA), true, false); this.add(typeof(RPI_I01_PROVIDER), true, true); this.add(typeof(PID), true, false); this.add(typeof(NK1), false, true); this.add(typeof(RPI_I01_GUARANTOR_INSURANCE), false, false); this.add(typeof(NTE), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RPI_I01 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Insured's Employment Start Date Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_25.verified.txt Retrieves the Insured's Employment Start Date (IN2-44). ```APIDOC ## GET /nhapinet/nhapi/insured/employment-start-date ### Description Retrieves the Insured's Employment Start Date (IN2-44). ### Method GET ### Endpoint /nhapinet/nhapi/insured/employment-start-date ### Parameters None ### Request Example None ### Response #### Success Response (200) - **employmentStartDate** (DT) - The Insured's Employment Start Date. #### Response Example ```json { "employmentStartDate": "20230101" } ``` ``` -------------------------------- ### Initialize PPP_PCB_GOAL_ROLE Group in C# Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_271.verified.txt Constructor for the PPP_PCB_GOAL_ROLE group, adding ROL and optional VAR segments. Logs errors if initialization fails. ```csharp public PPP_PCB_GOAL_ROLE(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(ROL), true, false); this.add(typeof(VAR), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPP_PCB_GOAL_ROLE - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Initialize RGV_O15_ORDER_DETAIL Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_28.verified.txt Creates a new RGV_O15_ORDER_DETAIL Group. This group contains RXO, PRT (optional repeating), and RGV_O15_ORDER_DETAIL_SUPPLEMENT (optional). ```csharp public RGV_O15_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(RXO), true, false); this.add(typeof(PRT), false, true); this.add(typeof(RGV_O15_ORDER_DETAIL_SUPPLEMENT), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RGV_O15_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Start Date/Time (AIS-4) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_231.verified.txt Retrieves the Start Date/Time (AIS-4) field. Handles HL7 and general exceptions. ```csharp public TS StartDateTime { get{ TS ret = null; try { IType t = this.GetField(4, 0); ret = (TS)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ``` -------------------------------- ### Get Start Date/Time Offset Units (AIL-8) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_26.verified.txt Retrieves the Start Date/Time Offset Units for the AIL segment (AIL-8). ```APIDOC ## GET /nhapinet/nhapi/location/startdatetimeoffsetunits ### Description Retrieves the Start Date/Time Offset Units (AIL-8) for the AIL segment. ### Method GET ### Endpoint /nhapinet/nhapi/location/startdatetimeoffsetunits ### Parameters None ### Request Example None ### Response #### Success Response (200) - **CNE** - The Start Date/Time Offset Units object. #### Response Example ```json { "identifier": "value", "text": "description" } ``` ``` -------------------------------- ### Initialize CCU_I20_MEDICATION_ADMINISTRATION_DETAIL Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_27.verified.txt Constructor for the CCU_I20_MEDICATION_ADMINISTRATION_DETAIL class. It initializes the structure by adding RXA, RXR, and OBX segments. ```csharp public CCU_I20_MEDICATION_ADMINISTRATION_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(RXA), true, true); this.add(typeof(RXR), true, false); this.add(typeof(OBX), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating CCU_I20_MEDICATION_ADMINISTRATION_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get First SUR_P09_FACILITY_DETAIL Structure Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/SourceGenerationTests.Test_Generate_Versions_version=2.3.1.verified.txt Retrieves the first instance of the SUR_P09_FACILITY_DETAIL structure. It is created if it does not already exist. ```csharp public SUR_P09_FACILITY_DETAIL GetFACILITY_DETAIL() { SUR_P09_FACILITY_DETAIL ret = null; try { ret = (SUR_P09_FACILITY_DETAIL)this.GetStructure("FACILITY_DETAIL"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error occurred",e); } return ret; } ``` -------------------------------- ### PEX_P07_NK1_TIMING_QTY Constructor Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_25.verified.txt Initializes the PEX_P07_NK1_TIMING_QTY group, adding TQ1 and TQ2 structures. TQ1 is required, TQ2 is optional and repeating. ```csharp public PEX_P07_NK1_TIMING_QTY(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(TQ1), true, false); this.add(typeof(TQ2), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PEX_P07_NK1_TIMING_QTY - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Install Specific HL7 Version Models Source: https://context7.com/nhapinet/nhapi/llms.txt To reduce application size, install only the specific HL7 version models required. This example shows how to install HL7 v2.4 support. ```xml ``` -------------------------------- ### Initialize PEX_P07_RX_ADMINISTRATION Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_251.verified.txt Constructor for the PEX_P07_RX_ADMINISTRATION group, adding RXA and RXR structures. Handles HL7 exceptions during initialization. ```csharp public PEX_P07_RX_ADMINISTRATION(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(RXA), true, false); this.add(typeof(RXR), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PEX_P07_RX_ADMINISTRATION - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get OCCURRENCESPANSTARTDATE Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_21.verified.txt Returns the OCCURRENCE SPAN START DATE (33)(UB1-18) field. ```APIDOC ## Get OCCURRENCESPANSTARTDATE ### Description Returns the OCCURRENCE SPAN START DATE (33)(UB1-18) field. ### Method GET ### Endpoint /nhapinet/nhapi ### Response #### Success Response (200) - **DT** (DT) - The OCCURRENCE SPAN START DATE value. #### Response Example ```json { "example": "YYYYMMDD" } ``` ``` -------------------------------- ### Initialize PPP_PCB_ORDER_DETAIL Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_24.verified.txt Constructor for the PPP_PCB_ORDER_DETAIL group, defining its constituent segments (OBR, RXO, NTE, VAR, PPP_PCB_ORDER_OBSERVATION) and their cardinality. ```csharp /// ///Represents the PPP_PCB_ORDER_DETAIL Group. A Group is an ordered collection of message /// segments that can repeat together or be optionally in/excluded together. /// This Group contains the following elements: ///
    ///
  1. 0: OBR (Observation Request)
  2. ///
  3. 1: RXO (Pharmacy/Treatment Order)
  4. ///
  5. 2: NTE (Notes and Comments) optional repeating
  6. ///
  7. 3: VAR (Variance) optional repeating
  8. ///
  9. 4: PPP_PCB_ORDER_OBSERVATION (a Group object) optional repeating
  10. ///
///
[Serializable] public class PPP_PCB_ORDER_DETAIL : AbstractGroup { /// /// Creates a new PPP_PCB_ORDER_DETAIL Group. /// public PPP_PCB_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(OBR), true, false); this.add(typeof(RXO), true, false); this.add(typeof(NTE), false, true); this.add(typeof(VAR), false, true); this.add(typeof(PPP_PCB_ORDER_OBSERVATION), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPP_PCB_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Total Field Repetitions Used (OBR-38) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_26.verified.txt Example of getting total repetitions for a field, specifically OBR-38. This snippet is part of a larger getter property and includes exception handling. ```csharp get{ try { return GetTotalFieldRepetitionsUsed(38); } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(this.GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception cce) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", cce); throw new System.Exception("An unexpected error occurred", cce); } } ``` -------------------------------- ### Get Total Field Repetitions Used (GT1-20) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_23.verified.txt Retrieves the total number of repetitions for a given field. This example specifically gets repetitions for field 20 (Goal Target Type). ```csharp return GetTotalFieldRepetitionsUsed(20); ``` -------------------------------- ### Initialize PGL_PC8_ORDER_DETAIL Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_23.verified.txt Constructor for PGL_PC8_ORDER_DETAIL. Adds OBR, NTE, VAR, and PGL_PC8_ORDER_OBSERVATION structures. ```csharp public PGL_PC8_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(OBR), true, false); this.add(typeof(NTE), false, true); this.add(typeof(VAR), false, true); this.add(typeof(PGL_PC8_ORDER_OBSERVATION), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PGL_PC8_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get RelationshipToThePatientStartDate Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_271.verified.txt Retrieves the Relationship to the Patient Start Date. Handles HL7 and general exceptions. ```csharp public DT RelationshipToThePatientStartDate { get{ DT ret = null; try { IType t = this.GetField(55, 0); ret = (DT)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ``` -------------------------------- ### DSR_Q03 Initialization Method Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/SourceGenerationTests.Test_Generate_Versions_version=2.1.verified.txt Initializes the DSR_Q03 message by adding required segments like MSH, QRD, QRF, DSP, and DSC. Handles HL7 exceptions during setup. ```csharp /// /// initialize method for DSR_Q03. This does the segment setup for the message. /// private void init(IModelClassFactory factory) { try { this.add(typeof(MSH), true, false); this.add(typeof(QRD), true, false); this.add(typeof(QRF), false, false); this.add(typeof(DSP), true, true); this.add(typeof(DSC), true, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating DSR_Q03 - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Managing RRG_O16_TIMING_GIVE Repetitions Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_251.verified.txt Code examples for getting, adding, and removing repetitions of the RRG_O16_TIMING_GIVE group. ```APIDOC ## Managing RRG_O16_TIMING_GIVE Repetitions ### Description Provides methods to interact with the repeating RRG_O16_TIMING_GIVE group within the RRG_O16_GIVE structure. ### Methods #### GetTIMING_GIVE() - **Description**: Returns the first repetition of RRG_O16_TIMING_GIVE, creating it if necessary. - **Returns**: `RRG_O16_TIMING_GIVE` #### GetTIMING_GIVE(int rep) - **Description**: Returns a specific repetition of RRG_O16_TIMING_GIVE. - **Parameters**: - **rep** (int) - The index of the repetition to retrieve. - **Returns**: `RRG_O16_TIMING_GIVE` - **Throws**: `HL7Exception` if the repetition requested is out of bounds. #### TIMING_GIVERepetitionsUsed - **Description**: Gets the number of existing repetitions of RRG_O16_TIMING_GIVE. - **Returns**: `int` #### TIMING_GIVEs (IEnumerable) - **Description**: Enumerates over all existing repetitions of RRG_O16_TIMING_GIVE. - **Returns**: `IEnumerable` #### AddTIMING_GIVE() - **Description**: Adds a new repetition of RRG_O16_TIMING_GIVE. - **Returns**: `RRG_O16_TIMING_GIVE` #### RemoveTIMING_GIVE(RRG_O16_TIMING_GIVE toRemove) - **Description**: Removes a specific RRG_O16_TIMING_GIVE instance. - **Parameters**: - **toRemove** (RRG_O16_TIMING_GIVE) - The instance to remove. #### RemoveTIMING_GIVEAt(int index) - **Description**: Removes the RRG_O16_TIMING_GIVE at the specified index. - **Parameters**: - **index** (int) - The index of the repetition to remove. ### Request Example ```csharp // Assuming 'rrgO16Give' is an instance of RRG_O16_GIVE // Get the first TIMING_GIVE RRG_O16_TIMING_GIVE timing1 = rrgO16Give.GetTIMING_GIVE(); // Add a new TIMING_GIVE RRG_O16_TIMING_GIVE newTiming = rrgO16Give.AddTIMING_GIVE(); // Iterate through all TIMING_GIVEs foreach (var timing in rrgO16Give.TIMING_GIVEs) { // Process each timing group } ``` ``` -------------------------------- ### Initialize RGV_O15_ORDER_DETAIL_SUPPLEMENT Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_24.verified.txt Constructor for the RGV_O15_ORDER_DETAIL_SUPPLEMENT group. It adds the NTE, RXR, and RGV_O15_COMPONENTS structures to the group. ```csharp public RGV_O15_ORDER_DETAIL_SUPPLEMENT(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(NTE), true, true); this.add(typeof(RXR), true, true); this.add(typeof(RGV_O15_COMPONENTS), false, false); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RGV_O15_ORDER_DETAIL_SUPPLEMENT - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Initialize PPV_PCA_ORDER_DETAIL group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_23.verified.txt Constructor for the PPV_PCA_ORDER_DETAIL group, setting up its constituent segments and groups. Includes error handling for HL7Exception during initialization. ```csharp public PPV_PCA_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(OBR), true, false); this.add(typeof(NTE), false, true); this.add(typeof(VAR), false, true); this.add(typeof(PPV_PCA_ORDER_OBSERVATION), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPV_PCA_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get psake Help Source: https://github.com/nhapinet/nhapi/blob/master/build/packages/psake.4.4.1/tools/README.markdown Display detailed help information and usage examples for the Invoke-psake cmdlet. ```powershell Get-Help Invoke-psake -Full ``` -------------------------------- ### Create PPP_PCB_GOAL_OBSERVATION Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_26.verified.txt Initializes a new instance of the PPP_PCB_GOAL_OBSERVATION group, adding OBX and optional NTE segments. Logs errors during creation. ```csharp public PPP_PCB_GOAL_OBSERVATION(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(OBX), true, false); this.add(typeof(NTE), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPP_PCB_GOAL_OBSERVATION - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get Structure Example Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_271.verified.txt Retrieves a structure by its name. Handles potential HL7 exceptions during data access. ```csharp ret = (OMS_O05_PATIENT)this.GetStructure("PATIENT"); ``` ```csharp ret = (OMS_O05_ORDER)this.GetStructure("ORDER"); ``` ```csharp return (OMS_O05_ORDER)this.GetStructure("ORDER", rep); ``` -------------------------------- ### Create PEX_P07_RX_ADMINISTRATION Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_281.verified.txt Initializes a new PEX_P07_RX_ADMINISTRATION group, adding RXA, RXR, and PRT segments. Logs errors if unexpected issues occur during creation. ```csharp /// /// Creates a new PEX_P07_RX_ADMINISTRATION Group. /// public PEX_P07_RX_ADMINISTRATION(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(RXA), true, false); this.add(typeof(RXR), false, false); this.add(typeof(PRT), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PEX_P07_RX_ADMINISTRATION - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Get StartDateTime Field (AIP-6) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_281.verified.txt Retrieves the Start Date/Time field (AIP-6) from the segment. Handles HL7 and general exceptions. ```csharp /// /// Returns Start Date/Time(AIP-6). /// public DTM StartDateTime { get{ DTM ret = null; try { IType t = this.GetField(6, 0); ret = (DTM)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ``` -------------------------------- ### Get StartDateTime Field (AIS-6) Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_28.verified.txt Retrieves the Start Date/Time field from the AIS segment. Handles HL7 and general exceptions. ```csharp /// /// Returns Start Date/Time(AIP-6). /// public DTM StartDateTime { get{ DTM ret = null; try { IType t = this.GetField(6, 0); ret = (DTM)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ``` -------------------------------- ### Initialize PPV_PCA_PATIENT Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_24.verified.txt Constructor for the PPV_PCA_PATIENT group, adding PID, PPV_PCA_PATIENT_VISIT, and PPV_PCA_GOAL elements. Logs errors if initialization fails. ```csharp /// /// Creates a new PPV_PCA_PATIENT Group. /// public PPV_PCA_PATIENT(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(PID), true, false); this.add(typeof(PPV_PCA_PATIENT_VISIT), false, false); this.add(typeof(PPV_PCA_GOAL), true, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPV_PCA_PATIENT - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Initialize PPG_PCJ_ORDER_DETAIL Group Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_23.verified.txt Constructor for the PPG_PCJ_ORDER_DETAIL group. It initializes the group with OBR, NTE, VAR, and PPG_PCJ_ORDER_OBSERVATION elements. ```csharp /// /// Creates a new PPG_PCJ_ORDER_DETAIL Group. /// public PPG_PCJ_ORDER_DETAIL(IGroup parent, IModelClassFactory factory) : base(parent, factory){ try { this.add(typeof(OBR), true, false); this.add(typeof(NTE), false, true); this.add(typeof(VAR), false, true); this.add(typeof(PPG_PCJ_ORDER_OBSERVATION), false, true); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating PPG_PCJ_ORDER_DETAIL - this is probably a bug in the source code generator.", e); } } ``` -------------------------------- ### Accessing and Manipulating NTE Segments Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/MessageGeneratorTests.MakeAll_GeneratesAllMessages_23.verified.txt This section provides code examples for accessing, retrieving, adding, and removing NTE (Notes and Comments) segments within the NHAPI V2.3 structure. It covers getting the first NTE, getting a specific repetition, checking the number of repetitions, iterating through all NTEs, adding a new NTE, and removing NTEs by object or index. ```APIDOC ## NTE Segment Operations ### Get First NTE Retrieves the first repetition of the NTE segment. Creates it if it does not exist. ```csharp public NTE GetNTE() { NTE ret = null; try { ret = (NTE)this.GetStructure("NTE"); } catch(HL7Exception e) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e); throw new System.Exception("An unexpected error occurred",e); } return ret; } ``` ### Get Specific NTE Repetition Retrieves a specific repetition of the NTE segment. Creates it if it does not exist. Throws HL7Exception if the repetition requested is more than one greater than the number of existing repetitions. ```csharp public NTE GetNTE(int rep) { return (NTE)this.GetStructure("NTE", rep); } ``` ### Number of NTE Repetitions Used Returns the number of existing repetitions of the NTE segment. ```csharp public int NTERepetitionsUsed { get { int reps = -1; try { reps = this.GetAll("NTE").Length; } catch (HL7Exception e) { string message = "Unexpected error accessing data - this is probably a bug in the source code generator."; HapiLogFactory.GetHapiLog(GetType()).Error(message, e); throw new System.Exception(message); } return reps; } } ``` ### Enumerate NTEs Provides an enumerable collection of all NTE segments. ```csharp public IEnumerable NTEs { get { for (int rep = 0; rep < NTERepetitionsUsed; rep++) { yield return (NTE)this.GetStructure("NTE", rep); } } } ``` ### Add NTE Adds a new NTE segment to the message. ```csharp public NTE AddNTE() { return this.AddStructure("NTE") as NTE; } ``` ### Remove NTE Removes a specific NTE segment instance. ```csharp public void RemoveNTE(NTE toRemove) { this.RemoveStructure("NTE", toRemove); } ``` ### Remove NTE at Index Removes the NTE segment at the specified index. ```csharp public void RemoveNTEAt(int index) { this.RemoveRepetition("NTE", index); } ``` ``` -------------------------------- ### Get Relationship To The Patient Start Date Source: https://github.com/nhapinet/nhapi/blob/master/tests/NHapi.NUnit.SourceGeneration/Generators/SegmentGeneratorTests.MakeAll_GeneratesAllSegments_23.verified.txt Retrieves the Relationship To The Patient Start Date (IN2-55). This field represents the start date of the relationship. ```csharp public DT RelationshipToThePatientStartDate { get{ DT ret = null; try { IType t = this.GetField(55, 0); ret = (DT)t; } catch (HL7Exception he) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", he); throw new System.Exception("An unexpected error occurred", he); } catch (System.Exception ex) { HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected problem obtaining field value. This is a bug.", ex); throw new System.Exception("An unexpected error occurred", ex); } return ret; } } ```