To include a new demo-dedupe field

To include a new demo-dedupe field

This document specifies the procedures for incorporating particular demographic attributes into the deduplication process, empowering the system to discern packets with identical demographic fields.

The Birth Registration Number (BRN)(This should be as per identity schema) is presented as an exemplary attribute, and the subsequent steps provide references for its integration within the demographic deduplication framework.

Module: Mosip-config

  1. Update `identity-mapping.json`:

  • Action: Add BRN attribute to the `identity-mapping.json`.

  • Location: `Mosip-config/identity-mapping.json`

"brn": { "value": "BRN" }

}

Database Change: regprc schema

  1. Database Schema Modification:

  • Action: Create a BRN column in `regprc.individual_demographic_dedup`.

  • Location: SQL Database Schema (`regprc.individual_demographic_dedup`)

Column Name : brn Datatype : character varying

Module: registration-processor

  1. Update `IndividualDemographicDedupe` Class:

  • Action: Add the BRN field to the `IndividualDemographicDedupe` class.

Package io.mosip.registration.processor.core.packet.dto.demographicinfo - Class: `IndividualDemographicDedupe.java` /** The brn. */ private String brn;
  1. Update `IndividualDemographicDedupeEntity` Class:

Action: Add the BRN field to the `IndividualDemographicDedupeEntity` class

Package io.mosip.registration.processor.packet.storage.entity - Class: `IndividualDemographicDedupeEntity.java` @Column(name = "brn", nullable = false) private String brn; /** Get the brn. * @return the brn */ public String getBrn() { return brn; } /** Sets the reg id. * @param regId the new reg id */ public void setBrn(String brn) { this.brn = brn; } public boolean equals(Object o) { /** add brn field in return */ return Objects.equals(brn, that.brn) } public int hashCode() { /** add brn field in return */ return Objects.hash(brn) }

@Colu

  1. Update `DemographicInfoDto` Class:

  • Action: Add the BRN field to the `DemographicInfoDto` class.

Package io.mosip.registration.processor.core.packet.dto.demographicinfo - Class: `DemographicInfoDto.java` /** The brn id. */ private String brn;
  1. Modify `PacketInfoManagerImpl` Class:

  • Action: Include the BRN field in the `getIdentityKeysAndFetchValuesFromJSON` method.

Package io.mosip.registration.processor.packet.storage.service.impl - Class: `PacketInfoManagerImpl.java` - Method: getIdentityKeysAndFetchValuesFromJSON String cnie= JsonUtil.getJSONValue( JsonUtil.getJSONObject(regProcessorIdentityJson, MappingJsonConstants.BRN), MappingJsonConstants.VALUE); fields.add(brn); demographicData.setBrn(fieldMap.get(brn));
  1. Modify `PacketInfoMapper` Class:

  • Action : Set BRN field in `converDemographicDedupeDtoToEntity` method. This

method is intended to be called within saveIndividualDemographicDedupeUpdatePacket method to insert the BRN number into the regprc.individual_demographic_dedup table.

package: io.mosip.registration.processor.packet.storage.mapper; - Class : PacketInfoMapper.java - Method : converDemographicDedupeDtoToEntity entity.setBrn(getHMACHashCode(demoDto.getBrn()));
  1. Update `DemoDedupe` Class:

  • Action: Modify the `performDedupe` method and Set the BRN field.

package: io.mosip.registration.processor.stages.demodedupe; - Class: `DemoDedupe.java` - Method : performDedupe infoDtos.addAll(packetInfoDao.getAllDemographicInfoDtos (demoDto.getName(), demoDto.getGenderCode(), demoDto.getDob(), demoDto.getLangCode(), demoDto.getBrn()));
  1. Update `PacketInfoDao` Class:

  • Action: Add the BRN field to the `getAllDemographicInfoDtos` method.

package: io.mosip.registration.processor.packet.storage.dao; - Class: `PacketInfoDao.java` - Method : getAllDemographicInfoDtos public List<DemographicInfoDto> getAllDemographicInfoDtos(String name, String gender, String dob, String langCode, String brn) List<IndividualDemographicDedupeEntity> demographicInfoEntities = getAllDemographicEntities(name, gender, dob, langCode, brn);

10. Update `PacketInfoDao` Class Query:

  • Action: Append the BRN field to the query in the `getAllDemographicEntities` method.

package: io.mosip.registration.processor.packet.storage.dao; - Class: `PacketInfoDao.java` - Method : getAllDemographicEntities private List<IndividualDemographicDedupeEntity> getAllDemographicEntities(String name, String gender, String dob, String langCode, String brn) if (brn != null) { query.append(alias + ".brn=:brn ").append(AND); params.put("brn", brn); }

11. Update `PacketInfoDao` Class for database Entity to DTO Conversion:

  • Action: Set the BRN field in the `convertEntityToDemographicDto` method.

package: io.mosip.registration.processor.packet.storage.dao; - Class: `PacketInfoDao.java` - Method : convertEntityToDemographicDto private DemographicInfoDto convertEntityToDemographicDto(IndividualDemographicDedupeEntity object) { DemographicInfoDto demo = new DemographicInfoDto(); /** set cnie field **/ demo.setBrn(object.getBrn()); return demo; }
  1. Restarting the demographic verification stage (Regproc Group 4) and processing a packet should confirm the proper storage of values within the Birth Registration Number (BRN) column in the db and the effective deduplication of records based on this attribute.

end

--------------------------------------------------------