Conversation
| .next(stepProcessConsent) | ||
| .next(stepProcessDiagnosticReport) | ||
| .next(stepProcessPractitioners) | ||
| .next(stepProcessPractitionerRole) |
There was a problem hiding this comment.
Please add step for Provenance resource as well.
There was a problem hiding this comment.
The provenance step does not exist yet in the codebase. This can be done after merging the appointment mapper PR.
SatwikSShanbhag
left a comment
There was a problem hiding this comment.
Thanks for good Explanation of PR
left few comments have a look
| @@ -40,25 +40,26 @@ public void beforeStep(StepExecution stepExecution) { | |||
| if (bulkload.equals(Boolean.TRUE)) { | |||
| log.info("========= Preparing OMOP DB for BulkLoad ========="); | |||
| truncateDb(); | |||
There was a problem hiding this comment.
is there any reason to move this code inside BulkLoad as I can see even in incremental load we need these setters ?
There was a problem hiding this comment.
I have not moved anything here. Its like this from beginning.
| .next(stepProcessDiagnosticReport) | ||
| .next(stepProcessPractitioners) | ||
| .next(stepProcessPractitionerRole) |
There was a problem hiding this comment.
| .next(stepProcessDiagnosticReport) | |
| .next(stepProcessPractitioners) | |
| .next(stepProcessPractitionerRole) | |
| .next(stepProcessDiagnosticReport) | |
| .next(stepProcessPractitioners) | |
| .next(stepProcessPractitionerRole) |
| ResourceFhirReferenceUtils referenceUtils, | ||
| IFhirPath fhirPath, | ||
| Boolean bulkload, | ||
| DbMappings dbMappings, OmopRepository repositories) { |
There was a problem hiding this comment.
| ResourceFhirReferenceUtils referenceUtils, | |
| IFhirPath fhirPath, | |
| Boolean bulkload, | |
| DbMappings dbMappings, OmopRepository repositories) { | |
| ResourceFhirReferenceUtils referenceUtils, | |
| IFhirPath fhirPath, | |
| Boolean bulkload, | |
| DbMappings dbMappings, | |
| OmopRepository repositories) { |
| private final OmopRepository repositories; | ||
|
|
There was a problem hiding this comment.
can we use EncounterDepartmentCaseMapperServiceImpl to manage repository operations.
| String departmentCaseLogicId, String departmentCaseLogicIdentifier) { | ||
| if (!Strings.isNullOrEmpty(departmentCaseLogicId)) { | ||
| departmentCaseMapperService.deleteExistingDepartmentcaseByLogicalId(departmentCaseLogicId); | ||
| repositories.getVisitDetailRepository().deleteEntriesByFhirLogicalId(departmentCaseLogicId); |
There was a problem hiding this comment.
define a delete function inside EncounterDepartmentCaseMapperServiceImpl and use this operation there
| private final Boolean bulkload; | ||
| private final DbMappings dbMappings; | ||
|
|
||
| private final OmopRepository repositories; |
There was a problem hiding this comment.
Same create a serviceImpl class and add repository operations there
| // readerTemplate.update( | ||
| // String.format("UPDATE %s SET last_updated_at=? WHERE fhir_id=?", inputTableName), | ||
| // LocalDateTime.now().plusDays(1), | ||
| // resourceId.substring(4)); |
There was a problem hiding this comment.
can you please explain more on what was happening before and why is this now commented?
There was a problem hiding this comment.
My bad I had commented it out by mistake.
There was a problem hiding this comment.
according to discussion we had this was commented before only. but here I can see we are commenting it
please explain more on this. pipeline id failing if we keep this piece of code.
| @Transactional | ||
| @Modifying | ||
| @Query(value = "DELETE FROM care_Site WHERE fhir_logical_id = :fhir_logical_id", nativeQuery = true) | ||
| void deleteCareSiteByLogicalId(@Param("fhir_logical_id") String fhirLogicalId); |
There was a problem hiding this comment.
you can use directly void deleteByFhirLogicalId(String fhirLogicalId); no need to add query, try this approach .
There was a problem hiding this comment.
use void deleteByFhirLogicalId(String fhirLogicalId); its available by default
| @Transactional | ||
| @Modifying | ||
| @Query(value = "DELETE FROM visit_detail WHERE visit_detail_id NOT IN (select min(visit_detail_id) from cds_cdm.visit_detail where fhir_logical_id = :fhir_logical_id group by visit_detail_id)", nativeQuery = true) |
There was a problem hiding this comment.
Is there any specific reason to delete rows which does not have given fhirLogicalId ?
There was a problem hiding this comment.
This not required can use the method already provided. Removing it.
| @Transactional | ||
| @Modifying | ||
| @Query(value = "DELETE FROM provider WHERE fhir_logical_id = :fhir_logical_id", nativeQuery = true) | ||
| void deleteProviderByLogicId(@Param("fhir_logical_id") String fhirLogicalId); |
There was a problem hiding this comment.
same try this void deleteByFhirLogicalId(String fhirLogicalId);
There was a problem hiding this comment.
deleteByFhirLogicalId(String fhirLogicalId) method does not exist in the ProviderRepository that is why I have added this to delete the entry by fhirLogicalId.
There was a problem hiding this comment.
its available by default just add and test
SatwikSShanbhag
left a comment
There was a problem hiding this comment.
please have a look at comments. even some of comments from previous review not addressed properly.
thanks
| dbMappings | ||
| .getOmopConceptMapWrapper() | ||
| .setFindValidSnomedConcept( | ||
| repositories.getConceptRepository().findValidConceptId(VOCABULARY_SNOMED)); | ||
| dbMappings.setFindSnomedRaceStandardMapping( | ||
| repositories.getSnomedRaceRepository().getSnomedRaceMap()); | ||
| dbMappings | ||
| .getOmopConceptMapWrapper() | ||
| .setFindValidIPRDConcept( | ||
| repositories.getConceptRepository().findValidConceptId(VOCABULARY_IPRD)); | ||
| dbMappings.getOmopConceptMapWrapper().setFindValidWHOConcept( | ||
| repositories.getConceptRepository().findValidConceptId(VOCABULARY_WHO) | ||
| ); |
There was a problem hiding this comment.
is there any reason to move this code inside BulkLoad as I can see even in incremental load we need these setters ?
There was a problem hiding this comment.
I am moving these setters outside the block to do this for both bulkload and incremental load.
| private final OmopRepository repositories; | ||
|
|
There was a problem hiding this comment.
also remove the variable if not used .
| DbMappings dbMappings, | ||
| OmopRepository repositories) { |
There was a problem hiding this comment.
we don't need to pass repository here remove it
|
|
||
| this.bulkload = bulkload; | ||
| this.dbMappings = dbMappings; | ||
| this.repositories = repositories; |
There was a problem hiding this comment.
remove this assigning of variable
| String departmentCaseLogicId, String departmentCaseLogicIdentifier) { | ||
| if (!Strings.isNullOrEmpty(departmentCaseLogicId)) { | ||
| departmentCaseMapperService.deleteExistingDepartmentcaseByLogicalId(departmentCaseLogicId); | ||
| departmentCaseMapperService.deleteExistingDepartmentCaseByFhirLogicalId(departmentCaseLogicId); |
There was a problem hiding this comment.
can you use previous function why we required this new function we already have deleteExistingDepartmentcaseByLogicalId which does the same thing.
There was a problem hiding this comment.
Its just renamed reverting back to the previous name to avoid any confusion.
|
|
||
| var quantityUnitCodingFormat = | ||
| new Coding().setCode(valueQuantity.getCode()).setSystem(valueQuantity.getSystem()); | ||
| if (valueQuantity.hasSystem()){ |
There was a problem hiding this comment.
how about units ? are they getting stored ?
| /** | ||
| * Delete FHIR Encounter resources from OMOP CDM tables using fhir_logical_id | ||
| * | ||
| * @param fhirLogicalId logical id of the FHIR Encounter resource | ||
| */ | ||
| public void deleteExistingDepartmentcaseByLogicalId(String fhirLogicalId) { | ||
| visitDetailRepository.deleteByFhirLogicalId(fhirLogicalId); | ||
| } | ||
|
|
There was a problem hiding this comment.
why this has been removed ? the new function which is added below is the same function with different name
There was a problem hiding this comment.
Not being removed. I have just changed the function name reverting back to avoid confusion.
| @Transactional | ||
| @Modifying | ||
| @Query(value = "DELETE FROM care_Site WHERE fhir_logical_id = :fhir_logical_id", nativeQuery = true) | ||
| void deleteCareSiteByLogicalId(@Param("fhir_logical_id") String fhirLogicalId); |
There was a problem hiding this comment.
use void deleteByFhirLogicalId(String fhirLogicalId); its available by default
| @Transactional | ||
| @Modifying | ||
| @Query(value = "DELETE FROM provider WHERE fhir_logical_id = :fhir_logical_id", nativeQuery = true) | ||
| void deleteProviderByLogicId(@Param("fhir_logical_id") String fhirLogicalId); |
There was a problem hiding this comment.
its available by default just add and test
| // readerTemplate.update( | ||
| // String.format("UPDATE %s SET last_updated_at=? WHERE fhir_id=?", inputTableName), | ||
| // LocalDateTime.now().plusDays(1), | ||
| // resourceId.substring(4)); |
There was a problem hiding this comment.
according to discussion we had this was commented before only. but here I can see we are commenting it
please explain more on this. pipeline id failing if we keep this piece of code.
|
SatwikSShanbhag
left a comment
There was a problem hiding this comment.
Looks good to me thanks
This PR fixes the incremental load flow in the ETL Pipeline.
Issues and fixes:
Constraint Issue:
a.
fpk_visit_detail_preceding_visit_detail_idthis constraint in thevisit_detailtable was causing problem because it links thevisit_detail_idand thepreceding_visit_detail_idin the visit_detail_id and causes problem while deleting or updating because the visit_detail id is being used some other entries because of the foreign key reference. To fix this issue addedON DELETE CASCADEto the constraint to make sure all the entries with the references will also be deleted along with that particular entry.b.
fpk_visit_occurrence_care_site_id, fpk_visit_detail_visit_occurrence_id, fpk_condition_occurrence_visit_occurrence_id, fpk_drug_exposure_visit_occurrence_id, fpk_measurement_visit_occurrence_id, fpk_observation_visit_occurrence_id, fpk_provider_care_site_idsame for this constraints as well in thecare_sitetable.In the custom mappers
OrganizationMapper,PractitionerMapperthe incremental load flow was not being handled. Added the check to handle that as well.Also in the
CareSiteRepository,VisitDetailRepositoryandProviderRepositoryadded queries to delete the entries usingfhir_logical_id.Also removed the part of the code from
ResourceOmopReferenceUtils.javaclass where the update was happening in the fhir gateway which is not required.In
TaskConfigurationadded thestepPractitionerandstepPractitionerRoleto the incremental load flow.