Repository: CDCgov/NEDSS-DataReporting
Pull request #438: CNDE-2750: Update Observation preprocessing for missing covid columns
Author: login: upasanapattnaik-eq
Created: 2025-05-30T12:34:32Z | Merged: 2025-05-30T19:22:47Z

## Notes

Update to Observation preprocessing to hydrate DEVICE_INSTANCE_ID_1, DEVICE_INSTANCE_ID_2, ORDER_TEST_DATE- for for Covid_Lab_Datamart. 

## JIRA

- **CNDE-2750**: [Jira Ticket](https://cdc-nbs.atlassian.net/browse/CNDE-2750)

## Checklist

- [x] PR focuses on a single story.
- [x] New unit tests added and ensured they pass.
- [x] Service has been tested in local and it works as expected.
- [ ] Documentation has been updated for this code change (if needed).
- [ ] Code follows the Java Coding Conventions (https://www.oracle.com/java/technologies/javase/codeconventions-programmingpractices.html).

## Types of changes

What types of changes does this PR introduces?

- [x] Bugfix
- [x] New feature
- [x] Breaking change

## Testing

- [x] Does this PR has >90% code coverage?
- [ ] Is the screenshot attached for code coverage?
- [ ] Does the `gradle build` pass in your local? 
- [ ] Is the `gradle build` logs attached?


Diff:
diff --git a/db/upgrade/odse/routines/005-sp_observation_event.sql b/db/upgrade/odse/routines/005-sp_observation_event.sql
index 239c7cce0..385549240 100644
--- a/db/upgrade/odse/routines/005-sp_observation_event.sql
+++ b/db/upgrade/odse/routines/005-sp_observation_event.sql
@@ -79,7 +79,8 @@ BEGIN
                      o.add_time      add_time,
                      o.last_chg_time last_chg_time,
                      o.record_status_time,
-                     o.status_time
+                     o.status_time,
+                     o.activity_from_time
                       ,nesteddata.person_participations
                       ,nesteddata.organization_participations
                       ,nesteddata.material_participations
@@ -101,9 +102,9 @@ BEGIN
                   FROM
                       -- follow up observations associated with observation-nested obs handling
                       (
-                          SELECT 
-                                STRING_AGG(ar.target_act_uid, ',') AS associated_phc_uids
-                          from nbs_odse.dbo.Act_relationship ar with (NOLOCK) 
+                          SELECT
+                              STRING_AGG(ar.target_act_uid, ',') AS associated_phc_uids
+                          from nbs_odse.dbo.Act_relationship ar with (NOLOCK)
                           where ar.type_cd IN ('MorbReport', 'LabReport')
                             and ar.target_class_cd = 'CASE'
                             and ar.source_act_uid = o.observation_uid
@@ -388,7 +389,7 @@ BEGIN
                               ) AS obs_num
                       ) AS obs_num -- can be more than 1
                   /* -- ldf_observation associated with observation
-                   (
+              (
                      SELECT
                        (
                         select * from nbs_odse..v_ldf_observation ldf
@@ -460,7 +461,7 @@ BEGIN
 
         IF @@TRANCOUNT > 0   ROLLBACK TRANSACTION;
 
-               -- Construct the error message string with all details:
+        -- Construct the error message string with all details:
         DECLARE @FullErrorMessage VARCHAR(8000) =
             'Error Number: ' + CAST(ERROR_NUMBER() AS VARCHAR(10)) + CHAR(13) + CHAR(10) +  -- Carriage return and line feed for new lines
             'Error Severity: ' + CAST(ERROR_SEVERITY() AS VARCHAR(10)) + CHAR(13) + CHAR(10) +
diff --git a/db/upgrade/rdb_modern/routines/016-sp_d_labtest_result_postprocessing.sql b/db/upgrade/rdb_modern/routines/016-sp_d_labtest_result_postprocessing.sql
index 89d01210a..3d3f4c959 100644
--- a/db/upgrade/rdb_modern/routines/016-sp_d_labtest_result_postprocessing.sql
+++ b/db/upgrade/rdb_modern/routines/016-sp_d_labtest_result_postprocessing.sql
@@ -36,7 +36,7 @@ BEGIN
         INSERT INTO [DBO].[JOB_FLOW_LOG]
         (BATCH_ID, [DATAFLOW_NAME], [PACKAGE_NAME], [STATUS_TYPE], [STEP_NUMBER], [STEP_NAME], [ROW_COUNT],
          [Msg_Description1])
-        VALUES (@BATCH_ID, @Dataflow_Name, @Package_Name, 'TEST', @PROC_STEP_NO, @PROC_STEP_NAME, @ROWCOUNT_NO,
+        VALUES (@BATCH_ID, @Dataflow_Name, @Package_Name, 'START', @PROC_STEP_NO, @PROC_STEP_NAME, @ROWCOUNT_NO,
                 LEFT(@pLabResultList, 500));
 
 --------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/db/upgrade/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing.sql b/db/upgrade/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing.sql
index f9881c108..fdca1b1f8 100644
--- a/db/upgrade/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing.sql
+++ b/db/upgrade/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing.sql
@@ -148,10 +148,6 @@ BEGIN
         SET @proc_step_name = 'Create COVID_LAB_CORE_DATA';
         SET @proc_step_no = 3;
 
-        --        select 'Test', *
---        FROM #COVID_TEXT_RESULT_LIST ctr
---         LEFT JOIN dbo.nrt_observation o WITH(NOLOCK) ON ctr.observation_uid = o.observation_uid
---
 
         SELECT DISTINCT
             o.observation_uid AS Observation_UID,
@@ -165,8 +161,7 @@ BEGIN
             o.jurisdiction_cd AS Jurisdiction_Cd,
             o.activity_to_time AS Lab_Report_Dt,
             o.rpt_to_state_time AS Lab_Rpt_Received_By_PH_Dt,
-            --o.activity_from_time AS ORDER_TEST_DATE, --Add to nrt_obs
-            NULL AS ORDER_TEST_DATE,
+            o.activity_from_time AS ORDER_TEST_DATE,
             o.target_site_cd AS SPECIMEN_SOURCE_SITE_CD,
             o.target_site_desc_txt AS SPECIMEN_SOURCE_SITE_DESC,
             cvg1.code_short_desc_txt AS Order_result_status,
@@ -193,10 +188,8 @@ BEGIN
             o1.cd AS Resulted_Test_Cd,
             o1.cd_desc_txt AS Resulted_Test_Desc,
             o1.cd_system_cd AS Resulted_Test_Code_System,
-            NULL AS DEVICE_INSTANCE_ID_1,
-            NULL AS DEVICE_INSTANCE_ID_2,
-            --eii.root_extension_txt AS DEVICE_INSTANCE_ID_1,
-            --eii2.root_extension_txt AS DEVICE_INSTANCE_ID_2,
+            o1.device_instance_id_1 AS DEVICE_INSTANCE_ID_1,
+            o1.device_instance_id_2 AS DEVICE_INSTANCE_ID_2,
             cvg2.code_short_desc_txt AS Test_result_status,
             o1.method_desc_txt AS Test_Method_Desc,
             CASE WHEN o1.method_cd LIKE '%**%'
@@ -245,12 +238,6 @@ BEGIN
             AND cvg2.code_set_nm = 'ACT_OBJ_ST'
                  LEFT OUTER JOIN dbo.nrt_observation_numeric ovn WITH(NOLOCK) ON o1.observation_uid = ovn.observation_uid AND isnull(o1.batch_id,1) = isnull(ovn.batch_id,1)
                  LEFT OUTER JOIN dbo.nrt_observation_material mat WITH(NOLOCK) ON o.material_id = mat.material_id
-            --                 LEFT OUTER JOIN nbs_odse.dbo.act_id eii WITH(NOLOCK) ON o1.observation_uid = eii.act_uid
---		            AND eii.type_cd = 'EII'
---		            AND eii.act_id_seq = 3
---                 LEFT OUTER JOIN nbs_odse.dbo.act_id eii2 WITH(NOLOCK) ON o1.observation_uid = eii2.act_uid
---		            AND eii2.type_cd = 'EII'
---		            AND eii2.act_id_seq = 4
                  LEFT OUTER JOIN dbo.nrt_organization org_perform WITH(NOLOCK) ON o1.performing_organization_id = org_perform.organization_uid
             --LEFT JOIN dbo.nrt_organization_key orgk WITH(NOLOCK) ON orgk.organization_uid = org_perform.organization_uid
                  LEFT OUTER JOIN dbo.D_Organization d_org_perform WITH(NOLOCK) ON o1.performing_organization_id = d_org_perform.ORGANIZATION_UID
@@ -584,7 +571,6 @@ BEGIN
                );
 
 
-
         /* Insert updated records */
         INSERT INTO dbo.COVID_LAB_DATAMART (
             Observation_UID,
diff --git a/db/upgrade/rdb_modern/tables/017-create_nrt_observation.sql b/db/upgrade/rdb_modern/tables/017-create_nrt_observation.sql
index 2eaf46626..35698a5e1 100644
--- a/db/upgrade/rdb_modern/tables/017-create_nrt_observation.sql
+++ b/db/upgrade/rdb_modern/tables/017-create_nrt_observation.sql
@@ -81,6 +81,9 @@ CREATE TABLE dbo.nrt_observation
     status_time                          datetime                                        NULL,
     batch_id                             bigint                                          NULL,
     associated_phc_uids                  nvarchar(max)                                   NULL,
+    activity_from_time                   datetime                                        NULL,
+    device_instance_id_1                 varchar(199)                                    NULL,
+    device_instance_id_2                 varchar(199)                                    NULL,
     refresh_datetime                     datetime2(7) GENERATED ALWAYS AS ROW START      NOT NULL,
     max_datetime                         datetime2(7) GENERATED ALWAYS AS ROW END HIDDEN NOT NULL,
     PERIOD FOR SYSTEM_TIME (refresh_datetime, max_datetime)
diff --git a/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-001.sql b/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-001.sql
index 239c7cce0..385549240 100644
--- a/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-001.sql
+++ b/liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-001.sql
@@ -79,7 +79,8 @@ BEGIN
                      o.add_time      add_time,
                      o.last_chg_time last_chg_time,
                      o.record_status_time,
-                     o.status_time
+                     o.status_time,
+                     o.activity_from_time
                       ,nesteddata.person_participations
                       ,nesteddata.organization_participations
                       ,nesteddata.material_participations
@@ -101,9 +102,9 @@ BEGIN
                   FROM
                       -- follow up observations associated with observation-nested obs handling
                       (
-                          SELECT 
-                                STRING_AGG(ar.target_act_uid, ',') AS associated_phc_uids
-                          from nbs_odse.dbo.Act_relationship ar with (NOLOCK) 
+                          SELECT
+                              STRING_AGG(ar.target_act_uid, ',') AS associated_phc_uids
+                          from nbs_odse.dbo.Act_relationship ar with (NOLOCK)
                           where ar.type_cd IN ('MorbReport', 'LabReport')
                             and ar.target_class_cd = 'CASE'
                             and ar.source_act_uid = o.observation_uid
@@ -388,7 +389,7 @@ BEGIN
                               ) AS obs_num
                       ) AS obs_num -- can be more than 1
                   /* -- ldf_observation associated with observation
-                   (
+              (
                      SELECT
                        (
                         select * from nbs_odse..v_ldf_observation ldf
@@ -460,7 +461,7 @@ BEGIN
 
         IF @@TRANCOUNT > 0   ROLLBACK TRANSACTION;
 
-               -- Construct the error message string with all details:
+        -- Construct the error message string with all details:
         DECLARE @FullErrorMessage VARCHAR(8000) =
             'Error Number: ' + CAST(ERROR_NUMBER() AS VARCHAR(10)) + CHAR(13) + CHAR(10) +  -- Carriage return and line feed for new lines
             'Error Severity: ' + CAST(ERROR_SEVERITY() AS VARCHAR(10)) + CHAR(13) + CHAR(10) +
diff --git a/liquibase-service/src/main/resources/db/rdb_modern/routines/017-sp_d_labtest_result_postprocessing-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/routines/017-sp_d_labtest_result_postprocessing-001.sql
index 89d01210a..3d3f4c959 100644
--- a/liquibase-service/src/main/resources/db/rdb_modern/routines/017-sp_d_labtest_result_postprocessing-001.sql
+++ b/liquibase-service/src/main/resources/db/rdb_modern/routines/017-sp_d_labtest_result_postprocessing-001.sql
@@ -36,7 +36,7 @@ BEGIN
         INSERT INTO [DBO].[JOB_FLOW_LOG]
         (BATCH_ID, [DATAFLOW_NAME], [PACKAGE_NAME], [STATUS_TYPE], [STEP_NUMBER], [STEP_NAME], [ROW_COUNT],
          [Msg_Description1])
-        VALUES (@BATCH_ID, @Dataflow_Name, @Package_Name, 'TEST', @PROC_STEP_NO, @PROC_STEP_NAME, @ROWCOUNT_NO,
+        VALUES (@BATCH_ID, @Dataflow_Name, @Package_Name, 'START', @PROC_STEP_NO, @PROC_STEP_NAME, @ROWCOUNT_NO,
                 LEFT(@pLabResultList, 500));
 
 --------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/liquibase-service/src/main/resources/db/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing-001.sql
index f9881c108..fdca1b1f8 100644
--- a/liquibase-service/src/main/resources/db/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing-001.sql
+++ b/liquibase-service/src/main/resources/db/rdb_modern/routines/330-sp_covid_lab_datamart_postprocessing-001.sql
@@ -148,10 +148,6 @@ BEGIN
         SET @proc_step_name = 'Create COVID_LAB_CORE_DATA';
         SET @proc_step_no = 3;
 
-        --        select 'Test', *
---        FROM #COVID_TEXT_RESULT_LIST ctr
---         LEFT JOIN dbo.nrt_observation o WITH(NOLOCK) ON ctr.observation_uid = o.observation_uid
---
 
         SELECT DISTINCT
             o.observation_uid AS Observation_UID,
@@ -165,8 +161,7 @@ BEGIN
             o.jurisdiction_cd AS Jurisdiction_Cd,
             o.activity_to_time AS Lab_Report_Dt,
             o.rpt_to_state_time AS Lab_Rpt_Received_By_PH_Dt,
-            --o.activity_from_time AS ORDER_TEST_DATE, --Add to nrt_obs
-            NULL AS ORDER_TEST_DATE,
+            o.activity_from_time AS ORDER_TEST_DATE,
             o.target_site_cd AS SPECIMEN_SOURCE_SITE_CD,
             o.target_site_desc_txt AS SPECIMEN_SOURCE_SITE_DESC,
             cvg1.code_short_desc_txt AS Order_result_status,
@@ -193,10 +188,8 @@ BEGIN
             o1.cd AS Resulted_Test_Cd,
             o1.cd_desc_txt AS Resulted_Test_Desc,
             o1.cd_system_cd AS Resulted_Test_Code_System,
-            NULL AS DEVICE_INSTANCE_ID_1,
-            NULL AS DEVICE_INSTANCE_ID_2,
-            --eii.root_extension_txt AS DEVICE_INSTANCE_ID_1,
-            --eii2.root_extension_txt AS DEVICE_INSTANCE_ID_2,
+            o1.device_instance_id_1 AS DEVICE_INSTANCE_ID_1,
+            o1.device_instance_id_2 AS DEVICE_INSTANCE_ID_2,
             cvg2.code_short_desc_txt AS Test_result_status,
             o1.method_desc_txt AS Test_Method_Desc,
             CASE WHEN o1.method_cd LIKE '%**%'
@@ -245,12 +238,6 @@ BEGIN
             AND cvg2.code_set_nm = 'ACT_OBJ_ST'
                  LEFT OUTER JOIN dbo.nrt_observation_numeric ovn WITH(NOLOCK) ON o1.observation_uid = ovn.observation_uid AND isnull(o1.batch_id,1) = isnull(ovn.batch_id,1)
                  LEFT OUTER JOIN dbo.nrt_observation_material mat WITH(NOLOCK) ON o.material_id = mat.material_id
-            --                 LEFT OUTER JOIN nbs_odse.dbo.act_id eii WITH(NOLOCK) ON o1.observation_uid = eii.act_uid
---		            AND eii.type_cd = 'EII'
---		            AND eii.act_id_seq = 3
---                 LEFT OUTER JOIN nbs_odse.dbo.act_id eii2 WITH(NOLOCK) ON o1.observation_uid = eii2.act_uid
---		            AND eii2.type_cd = 'EII'
---		            AND eii2.act_id_seq = 4
                  LEFT OUTER JOIN dbo.nrt_organization org_perform WITH(NOLOCK) ON o1.performing_organization_id = org_perform.organization_uid
             --LEFT JOIN dbo.nrt_organization_key orgk WITH(NOLOCK) ON orgk.organization_uid = org_perform.organization_uid
                  LEFT OUTER JOIN dbo.D_Organization d_org_perform WITH(NOLOCK) ON o1.performing_organization_id = d_org_perform.ORGANIZATION_UID
@@ -584,7 +571,6 @@ BEGIN
                );
 
 
-
         /* Insert updated records */
         INSERT INTO dbo.COVID_LAB_DATAMART (
             Observation_UID,
diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-001.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-001.sql
index 16e01f406..9a681be1e 100644
--- a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-001.sql
+++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-001.sql
@@ -372,4 +372,23 @@ IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation' and xtype = '
                 ALTER TABLE dbo.nrt_observation
                 ALTER COLUMN ordering_person_id NVARCHAR(max)
             END;
+
+--CNDE-2750
+        IF NOT EXISTS(SELECT 1 FROM sys.columns   WHERE Name = N'activity_from_time'   AND Object_ID = Object_ID(N'nrt_observation'))
+            BEGIN
+                ALTER TABLE dbo.nrt_observation
+                ADD activity_from_time datetime;
+            END;
+
+        IF NOT EXISTS(SELECT 1 FROM sys.columns   WHERE Name = N'device_instance_id_1'   AND Object_ID = Object_ID(N'nrt_observation'))
+            BEGIN
+                ALTER TABLE dbo.nrt_observation
+                ADD device_instance_id_1 varchar(199);
+            END;
+
+        IF NOT EXISTS(SELECT 1 FROM sys.columns   WHERE Name = N'device_instance_id_2'   AND Object_ID = Object_ID(N'nrt_observation'))
+            BEGIN
+                ALTER TABLE dbo.nrt_observation
+                ADD device_instance_id_2 varchar(199);
+            END;
     END;
\ No newline at end of file
diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java
index 587ebfd07..1fa18ac13 100644
--- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java
+++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java
@@ -147,6 +147,9 @@ public class Observation {
     @Column(name = "status_time")
     private String statusTime;
 
+    @Column(name = "activity_from_time")
+    private String activityFromTime;
+
     @Column(name = "associated_phc_uids")
     private String associatedPhcUids;
 
diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/ObservationTransformed.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/ObservationTransformed.java
index cf6deef75..0ecd78de1 100644
--- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/ObservationTransformed.java
+++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/ObservationTransformed.java
@@ -1,5 +1,6 @@
 package gov.cdc.etldatapipeline.observation.repository.model.dto;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.*;
 
 @Data
@@ -44,5 +45,10 @@ public class ObservationTransformed {
     private String accessionNumber;
     private Long materialId;
 
+    @JsonProperty("device_instance_id_1")
+    private String deviceInstanceId1;
+    @JsonProperty("device_instance_id_2")
+    private String deviceInstanceId2;
+
     private Long batchId;
 }
diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java
index b1f6d141a..dfeb22c0b 100644
--- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java
+++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java
@@ -100,4 +100,10 @@ public class ObservationReporting {
     private Long batchId;
 
     private String associatedPhcUids;
+    private String activityFromTime;
+
+    @JsonProperty("device_instance_id_1")
+    private String deviceInstanceId1;
+    @JsonProperty("device_instance_id_2")
+    private String deviceInstanceId2;
 }
diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/util/ProcessObservationDataUtil.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/util/ProcessObservationDataUtil.java
index 8c242776a..d3f03d320 100644
--- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/util/ProcessObservationDataUtil.java
+++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/util/ProcessObservationDataUtil.java
@@ -59,6 +59,8 @@ public class ProcessObservationDataUtil {
     public static final String ENTITY_ID = "entity_id";
     public static final String ORDER = "Order";
     public static final String RESULT = "Result";
+    public static final String ACT_ID_SEQ = "act_id_seq";
+    public static final String ROOT_EXTENSION_TXT = "root_extension_txt";
 
     public ObservationTransformed transformObservationData(Observation observation, long batchId) {
         ObservationTransformed observationTransformed = new ObservationTransformed();
@@ -313,10 +315,19 @@ private void transformActIds(String actIds, ObservationTransformed observationTr
 
             for (JsonNode jsonNode : actIdsJsonArray) {
                 String typeCd = getNodeValue(jsonNode, TYPE_CD, JsonNode::asText);
+                Integer actIdSeq = getNodeValue(jsonNode, ACT_ID_SEQ, JsonNode::asInt);
                 if (typeCd.equals("FN")) {
-                    String rootExtTxt = getNodeValue(jsonNode, "root_extension_txt", JsonNode::asText);
+                    String rootExtTxt = getNodeValue(jsonNode, ROOT_EXTENSION_TXT, JsonNode::asText);
                     observationTransformed.setAccessionNumber(rootExtTxt);
                 }
+                if (typeCd.equals("EII") && actIdSeq.equals(3)) {
+                    String rootExtTxt = getNodeValue(jsonNode, ROOT_EXTENSION_TXT, JsonNode::asText);
+                    observationTransformed.setDeviceInstanceId1(rootExtTxt);
+                }
+                if (typeCd.equals("EII") && actIdSeq.equals(4)) {
+                    String rootExtTxt = getNodeValue(jsonNode, ROOT_EXTENSION_TXT, JsonNode::asText);
+                    observationTransformed.setDeviceInstanceId2(rootExtTxt);
+                }
             }
         } catch (IllegalArgumentException ex) {
             logger.info(ex.getMessage(), "ActIds", actIds);
diff --git a/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/service/ObservationServiceTest.java b/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/service/ObservationServiceTest.java
index f5a934974..496d66060 100644
--- a/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/service/ObservationServiceTest.java
+++ b/observation-service/src/test/java/gov/cdc/etldatapipeline/observation/service/ObservationServiceTest.java
@@ -213,6 +213,7 @@ private Observation constructObservation(Long observationUid, String obsDomainCd
         observation.setClassCd("OBS");
         observation.setMoodCd("ENV");
         observation.setLocalId("OBS10003388MA01");
+        observation.setActivityFromTime("2021-01-28 16:06:03.000");
         observation.setObsDomainCdSt1(obsDomainCdSt1);
         observation.setPersonParticipations(readFileData(filePathPrefix + "PersonParticipations.json"));
         observation.setOrganizationParticipations(readFileData(filePathPrefix + "OrganizationParticipations.json"));
@@ -266,6 +267,9 @@ private ObservationReporting constructObservationReporting(Long observationUid,
         observation.setSpecimenCollectorId(10000033L);
         observation.setCopyToProviderId(10000044L);
         observation.setAccessionNumber("20120601114");
+        observation.setActivityFromTime("2021-01-28 16:06:03.000");
+        observation.setDeviceInstanceId1("No Equipment");
+        observation.setDeviceInstanceId2("NEW TOOLS");
 
         return observation;
     }
diff --git a/observation-service/src/test/resources/rawDataFiles/ActIds.json b/observation-service/src/test/resources/rawDataFiles/ActIds.json
index 122dad6f0..b35df9b24 100644
--- a/observation-service/src/test/resources/rawDataFiles/ActIds.json
+++ b/observation-service/src/test/resources/rawDataFiles/ActIds.json
@@ -17,4 +17,24 @@
     "type_desc_txt": "Filler Number",
     "act_last_change_time": null
   }
+,
+  {
+    "id": 10361979,
+    "act_id_seq": 3,
+    "record_status": "ACTIVE",
+    "root_extension_txt": "No Equipment",
+    "type_cd": "EII",
+    "type_desc_txt": "Equipment Instance Identifier",
+    "act_last_change_time": null
+  }
+,
+  {
+    "id": 10361979,
+    "act_id_seq": 4,
+    "record_status": "INACTIVE",
+    "root_extension_txt": "NEW TOOLS",
+    "type_cd": "EII",
+    "type_desc_txt": "Equipment Instance Identifier",
+    "act_last_change_time": null
+  }
 ]
\ No newline at end of file


Reviews:
user: login: sveselev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-30T13:28:17Z
user: login: sveselev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-30T13:28:51Z
user: login: sveselev
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-30T13:30:08Z
user: login: sveselev
body: LGTM!
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-30T13:30:21Z

Review comments:
diff_hunk: @@ -59,6 +59,7 @@ public class ProcessObservationDataUtil {
     public static final String ENTITY_ID = "entity_id";
     public static final String ORDER = "Order";
     public static final String RESULT = "Result";
+    public static final String ACT_ID_SEQ = "act_id_seq";
path: observation-service/src/main/java/gov/cdc/etldatapipeline/observation/util/ProcessObservationDataUtil.java
user: login: sveselev
body: 👍
created_at: 2025-05-30T13:28:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -79,7 +79,8 @@ BEGIN
                      o.add_time      add_time,
                      o.last_chg_time last_chg_time,
                      o.record_status_time,
-                     o.status_time
+                     o.status_time,
+                     o.activity_from_time
path: liquibase-service/src/main/resources/db/odse/routines/009-sp_observation_event-001.sql
user: login: sveselev
body: 👍
created_at: 2025-05-30T13:28:51Z
author_association: CONTRIBUTOR
diff_hunk: @@ -313,10 +314,19 @@ private void transformActIds(String actIds, ObservationTransformed observationTr
 
             for (JsonNode jsonNode : actIdsJsonArray) {
                 String typeCd = getNodeValue(jsonNode, TYPE_CD, JsonNode::asText);
+                Integer actIdSeq = getNodeValue(jsonNode, ACT_ID_SEQ, JsonNode::asInt);
path: observation-service/src/main/java/gov/cdc/etldatapipeline/observation/util/ProcessObservationDataUtil.java
user: login: sveselev
body: 👍
created_at: 2025-05-30T13:30:08Z
author_association: CONTRIBUTOR

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-05-30T19:17:41Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=CDCgov_NEDSS-DataReporting&pullRequest=438) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=CDCgov_NEDSS-DataReporting&pullRequest=438&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=CDCgov_NEDSS-DataReporting&pullRequest=438&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=CDCgov_NEDSS-DataReporting&pullRequest=438&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=CDCgov_NEDSS-DataReporting&pullRequest=438&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=CDCgov_NEDSS-DataReporting&pullRequest=438&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=CDCgov_NEDSS-DataReporting&pullRequest=438)


author_association: NONE