-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for loading custom vocabulary configs in realtime
-See code validator for implementation -2 new properties added in referenceccdaservice.xml --referenceccda.isDynamicVocab ---Set to false if wating to use a single pre-loaded default config only like past versions of the validator ---Set to true for the option to use one or more custom dynamically loaded configs determined by API form-data vocabularyConfig key which should have a value set to the name of the file excepting the .xml extension --referenceccda.configFolder ---Set to the path to hold the configs. This can be the same directory as the current default config path or a completely different directory. Error handling is implemented to handle either scenario. If for any reason a custom dynamic config is not found, the default config will be loaded, if it exists.
- Loading branch information
drbgfc
committed
Jun 13, 2018
1 parent
bf96fe2
commit 852dc26
Showing
6 changed files
with
210 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<configurations> | ||
|
||
<!-- TODO: Define the differences for this --> | ||
|
||
</configurations> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 79 additions & 76 deletions
155
src/main/java/org/sitenv/referenceccda/controllers/ReferenceCCDAValidationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,79 @@ | ||
package org.sitenv.referenceccda.controllers; | ||
|
||
import org.sitenv.referenceccda.dto.ValidationResultsDto; | ||
import org.sitenv.referenceccda.services.ReferenceCCDAValidationService; | ||
import org.sitenv.referenceccda.services.VocabularyService; | ||
import org.sitenv.vocabularies.validation.entities.Code; | ||
import org.sitenv.vocabularies.validation.entities.VsacValueSet; | ||
import org.sitenv.vocabularies.validation.services.VocabularyValidationService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@RestController | ||
public class ReferenceCCDAValidationController { | ||
@Autowired | ||
ReferenceCCDAValidationService referenceCcdaValidationService; | ||
@Autowired | ||
VocabularyService vocabularyService; | ||
@Autowired | ||
VocabularyValidationService validationManager; | ||
|
||
private static final String GITHUB_URL = "https://api.github.com/repos/siteadmin/2015-Certification-C-CDA-Test-Data/git/trees/master?recursive=1"; | ||
|
||
@RequestMapping(value = "/", headers = "content-type=multipart/*", method = RequestMethod.POST) | ||
public ValidationResultsDto doValidation( | ||
@RequestParam(value = "validationObjective", required = true) String validationObjective, | ||
@RequestParam(value = "referenceFileName", required = true) String referenceFileName, | ||
@RequestParam(value = "ccdaFile", required = true) MultipartFile ccdaFile) { | ||
return referenceCcdaValidationService.validateCCDA(validationObjective, referenceFileName, ccdaFile); | ||
} | ||
|
||
@RequestMapping(value = "/getvaluesetsbyoids", method = RequestMethod.GET) | ||
public List<VsacValueSet> getValuesetsByOids(@RequestParam(value = "oids", required = true) String[] valuesetOids){ | ||
return vocabularyService.getValuesetsByOids(Arrays.asList(valuesetOids)); | ||
} | ||
|
||
@RequestMapping(value = "/getbycodeincodesystem", method = RequestMethod.GET) | ||
public List<Code> getByCodeInCodeSystems(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "codeSystems", required = true) String[] codeSystems){ | ||
return vocabularyService.getByCodeInCodesystems(code, Arrays.asList(codeSystems)); | ||
} | ||
|
||
@RequestMapping(value = "/getbycodeinvaluesetoid", method = RequestMethod.GET) | ||
public List<VsacValueSet> getByCodeInValuesetOid(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "oids", required = true) String[] valuesetOids){ | ||
return vocabularyService.getByCodeInValuesetOids(code, Arrays.asList(valuesetOids)); | ||
} | ||
|
||
@RequestMapping(value = "/iscodeandisplaynameincodesystem", method = RequestMethod.GET) | ||
public boolean isCodeAndDisplayNameFoundInCodeSystems(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "displayName", required = true)String displayName, @RequestParam(value = "codeSystems", required = true) String[] codeSystems){ | ||
return vocabularyService.isCodeAndDisplayNameFoundInCodeSystems(code, displayName, Arrays.asList(codeSystems)); | ||
} | ||
|
||
@RequestMapping(value = "/iscodeincodesystem", method = RequestMethod.GET) | ||
public boolean isCodeFoundInCodeSystems(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "codeSystems", required = true) String[] codeSystems){ | ||
return vocabularyService.isCodeFoundInCodesystems(code, Arrays.asList(codeSystems)); | ||
} | ||
|
||
@RequestMapping(value = "/iscodeinvalueset", method = RequestMethod.GET) | ||
public boolean isCodeFoundInValuesetOids(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "valuesetOids", required = true) String[] valuesetOids){ | ||
return vocabularyService.isCodeFoundInValuesetOids(code, Arrays.asList(valuesetOids)); | ||
} | ||
|
||
@Cacheable("messagetypeValidationObjectivesAndReferenceFilesMap") | ||
@RequestMapping(value = "/senderreceivervalidationobjectivesandreferencefiles", method = RequestMethod.GET) | ||
public Map<String, Map<String, List<String>>> getMapOfSenderAndRecieverValidationObjectivesWithReferenceFiles(){ | ||
return vocabularyService.getMapOfSenderAndRecieverValidationObjectivesWithReferenceFiles(); | ||
} | ||
|
||
} | ||
package org.sitenv.referenceccda.controllers; | ||
|
||
import org.sitenv.referenceccda.dto.ValidationResultsDto; | ||
import org.sitenv.referenceccda.services.ReferenceCCDAValidationService; | ||
import org.sitenv.referenceccda.services.VocabularyService; | ||
import org.sitenv.vocabularies.constants.VocabularyConstants; | ||
import org.sitenv.vocabularies.validation.entities.Code; | ||
import org.sitenv.vocabularies.validation.entities.VsacValueSet; | ||
import org.sitenv.vocabularies.validation.services.VocabularyValidationService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@RestController | ||
public class ReferenceCCDAValidationController { | ||
@Autowired | ||
ReferenceCCDAValidationService referenceCcdaValidationService; | ||
@Autowired | ||
VocabularyService vocabularyService; | ||
@Autowired | ||
VocabularyValidationService validationManager; | ||
|
||
private static final String GITHUB_URL = "https://api.github.com/repos/siteadmin/2015-Certification-C-CDA-Test-Data/git/trees/master?recursive=1"; | ||
|
||
@RequestMapping(value = "/", headers = "content-type=multipart/*", method = RequestMethod.POST) | ||
public ValidationResultsDto doValidation( | ||
@RequestParam(value = "validationObjective", required = true) String validationObjective, | ||
@RequestParam(value = "referenceFileName", required = true) String referenceFileName, | ||
@RequestParam(value = "ccdaFile", required = true) MultipartFile ccdaFile, | ||
@RequestParam(defaultValue = VocabularyConstants.Config.DEFAULT, required = false) String vocabularyConfig) { | ||
return referenceCcdaValidationService.validateCCDA(validationObjective, referenceFileName, ccdaFile, | ||
vocabularyConfig); | ||
} | ||
|
||
@RequestMapping(value = "/getvaluesetsbyoids", method = RequestMethod.GET) | ||
public List<VsacValueSet> getValuesetsByOids(@RequestParam(value = "oids", required = true) String[] valuesetOids){ | ||
return vocabularyService.getValuesetsByOids(Arrays.asList(valuesetOids)); | ||
} | ||
|
||
@RequestMapping(value = "/getbycodeincodesystem", method = RequestMethod.GET) | ||
public List<Code> getByCodeInCodeSystems(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "codeSystems", required = true) String[] codeSystems){ | ||
return vocabularyService.getByCodeInCodesystems(code, Arrays.asList(codeSystems)); | ||
} | ||
|
||
@RequestMapping(value = "/getbycodeinvaluesetoid", method = RequestMethod.GET) | ||
public List<VsacValueSet> getByCodeInValuesetOid(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "oids", required = true) String[] valuesetOids){ | ||
return vocabularyService.getByCodeInValuesetOids(code, Arrays.asList(valuesetOids)); | ||
} | ||
|
||
@RequestMapping(value = "/iscodeandisplaynameincodesystem", method = RequestMethod.GET) | ||
public boolean isCodeAndDisplayNameFoundInCodeSystems(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "displayName", required = true)String displayName, @RequestParam(value = "codeSystems", required = true) String[] codeSystems){ | ||
return vocabularyService.isCodeAndDisplayNameFoundInCodeSystems(code, displayName, Arrays.asList(codeSystems)); | ||
} | ||
|
||
@RequestMapping(value = "/iscodeincodesystem", method = RequestMethod.GET) | ||
public boolean isCodeFoundInCodeSystems(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "codeSystems", required = true) String[] codeSystems){ | ||
return vocabularyService.isCodeFoundInCodesystems(code, Arrays.asList(codeSystems)); | ||
} | ||
|
||
@RequestMapping(value = "/iscodeinvalueset", method = RequestMethod.GET) | ||
public boolean isCodeFoundInValuesetOids(@RequestParam(value = "code", required = true)String code, @RequestParam(value = "valuesetOids", required = true) String[] valuesetOids){ | ||
return vocabularyService.isCodeFoundInValuesetOids(code, Arrays.asList(valuesetOids)); | ||
} | ||
|
||
@Cacheable("messagetypeValidationObjectivesAndReferenceFilesMap") | ||
@RequestMapping(value = "/senderreceivervalidationobjectivesandreferencefiles", method = RequestMethod.GET) | ||
public Map<String, Map<String, List<String>>> getMapOfSenderAndRecieverValidationObjectivesWithReferenceFiles(){ | ||
return vocabularyService.getMapOfSenderAndRecieverValidationObjectivesWithReferenceFiles(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.