Skip to content

Commit cdc246e

Browse files
vishwab1claude
andcommitted
fix: sync beneficiary economicStatus/residentialArea on edit (STOP-444)
Same class of bug as the earlier occupation/community fix, found while investigating two more fields reported not updating: "type of residential area" and "socioeconomic status". Both economicStatus/economicStatusId and residentialArea/residentialAreaId are real columns on i_beneficiarydetails -- confirmed 100% NULL across every row in the table, including freshly created ones, meaning no code path (create or edit) had ever written to them. The app already sends both values every sync, nested inside i_bendemographics. residentialArea/residentialAreaId were initially (incorrectly) placed on RMNCHMBeneficiaryaddress in an earlier pass of this fix -- caught and corrected by cross-checking against FLW-API's own RMNCHMBeneficiarydetail, which already declares both fields on i_beneficiarydetails. That mistake never shipped; caught before this branch was ever restarted with it. Every field touched across both fix commits (community, occupation, religion, economicStatus, residentialArea, pinCode, block, district, village, phone) has now been cross-verified against FLW-API's independently-built entity model for the same tables, not just assumed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 5c8b670 commit cdc246e

3 files changed

Lines changed: 59 additions & 3 deletions

File tree

‎src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,18 @@ public class RMNCHBeneficiaryDetailsRmnch {
422422
private String phoneNo;
423423
@Expose
424424
@Transient
425+
private String economicStatus;
426+
@Expose
427+
@Transient
428+
private Integer economicStatusId;
429+
@Expose
430+
@Transient
431+
private String residentialArea;
432+
@Expose
433+
@Transient
434+
private Integer residentialAreaId;
435+
@Expose
436+
@Transient
425437
private String contact_number;
426438
@Expose
427439
@Transient

‎src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiarydetail.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,24 @@ public class RMNCHMBeneficiarydetail {
111111
@Column(length = 45)
112112
private String occupation;
113113

114+
// STOP-444 followup fix: column exists (economicStatus/economicStatusId on
115+
// i_beneficiarydetails) and is 100% NULL across every row, including freshly
116+
// created ones — confirmed no code path, create or edit, has ever written to it.
117+
// The app sends this value (inside i_bendemographics) every time.
118+
private Integer economicStatusId;
119+
120+
@Column(length = 45)
121+
private String economicStatus;
122+
123+
// STOP-444 followup fix: same situation as economicStatus above — real column,
124+
// never written. Originally (wrongly) placed on the address entity in an earlier
125+
// pass; corrected here to match where FLW-API's own RMNCHMBeneficiarydetail already
126+
// declares it, confirming this is the real table.
127+
private Integer residentialAreaId;
128+
129+
@Column(name = "residentialArea")
130+
private String residentialArea;
131+
114132
private Integer phcId;
115133

116134
@Column(length = 30)

‎src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ public String syncDataToAmrit(String requestOBJ, String authorization) throws Ex
223223
if (demog.has("isGpsUnavailable") && !demog.get("isGpsUnavailable").isJsonNull())
224224
obj.setIsGpsUnavailable(demog.get("isGpsUnavailable").getAsBoolean());
225225
// STOP-444 followup fix: same source object, previously never read for
226-
// anything but GPS. economicStatus deliberately NOT extracted here — its
227-
// correct persisted home is unconfirmed (looks like it belongs on the
228-
// household record, i_householddetails.type_bpl_apl, not the beneficiary).
226+
// anything but GPS.
229227
if (demog.has("occupation") && !demog.get("occupation").isJsonNull())
230228
obj.setOccupation(demog.get("occupation").getAsString());
231229
if (demog.has("communityName") && !demog.get("communityName").isJsonNull())
@@ -236,6 +234,18 @@ public String syncDataToAmrit(String requestOBJ, String authorization) throws Ex
236234
obj.setPinCode(demog.get("pinCode").getAsString());
237235
if (demog.has("blockID") && !demog.get("blockID").isJsonNull())
238236
obj.setBlockId(demog.get("blockID").getAsInt());
237+
// STOP-444 followup fix: economicStatus previously skipped here — turned
238+
// out i_beneficiarydetails.economicStatus/economicStatusId genuinely exist
239+
// (confirmed via schema, not just source code — 100% NULL across every row
240+
// including fresh ones), so this is the correct persisted home after all.
241+
if (demog.has("economicStatus") && !demog.get("economicStatus").isJsonNull())
242+
obj.setEconomicStatus(demog.get("economicStatus").getAsString());
243+
if (demog.has("economicStatusId") && !demog.get("economicStatusId").isJsonNull())
244+
obj.setEconomicStatusId(demog.get("economicStatusId").getAsInt());
245+
if (demog.has("residentialArea") && !demog.get("residentialArea").isJsonNull())
246+
obj.setResidentialArea(demog.get("residentialArea").getAsString());
247+
if (demog.has("residentialAreaId") && !demog.get("residentialAreaId").isJsonNull())
248+
obj.setResidentialAreaId(demog.get("residentialAreaId").getAsInt());
239249
}
240250
// STOP-444 followup fix: phone number is sent as benPhoneMaps[0].phoneNo, not
241251
// a flat field — same lowercase-key mismatch problem as village/block below.
@@ -342,6 +352,22 @@ public String syncDataToAmrit(String requestOBJ, String authorization) throws Ex
342352
if (obj.getReligionID() != null) {
343353
rmnchmBeneficiarydetail.setReligionID(obj.getReligionID());
344354
}
355+
if (obj.getEconomicStatus() != null) {
356+
rmnchmBeneficiarydetail.setEconomicStatus(obj.getEconomicStatus());
357+
}
358+
if (obj.getEconomicStatusId() != null) {
359+
rmnchmBeneficiarydetail.setEconomicStatusId(obj.getEconomicStatusId());
360+
}
361+
// STOP-444 followup fix: residentialArea/residentialAreaId — corrected here
362+
// from an earlier (wrong) placement on the address entity; confirmed against
363+
// FLW-API's own RMNCHMBeneficiarydetail, which already declares these fields
364+
// on this same table.
365+
if (obj.getResidentialArea() != null) {
366+
rmnchmBeneficiarydetail.setResidentialArea(obj.getResidentialArea());
367+
}
368+
if (obj.getResidentialAreaId() != null) {
369+
rmnchmBeneficiarydetail.setResidentialAreaId(obj.getResidentialAreaId());
370+
}
345371
if(obj.getFamilyId()!=null && !obj.getFamilyId().isEmpty()){
346372
rmnchmBeneficiarydetail.setFamilyId(obj.getFamilyId());
347373

0 commit comments

Comments
 (0)