use of org.snomed.snowstorm.core.data.services.pojo.MemberSearchRequest in project snowstorm by IHTSDO.
the class MRCMLoader method getDomains.
private List<Domain> getDomains(final String branchPath, final BranchCriteria branchCriteria, final TimerUtil timer) {
List<ReferenceSetMember> domainMembers = memberService.findMembers(branchPath, branchCriteria, new MemberSearchRequest().referenceSet(Concepts.REFSET_MRCM_DOMAIN_INTERNATIONAL), LARGE_PAGE).getContent();
List<Domain> domains = new ArrayList<>();
for (ReferenceSetMember member : domainMembers) {
// proximalPrimitiveConstraint proximalPrimitiveRefinement domainTemplateForPrecoordination domainTemplateForPostcoordination guideURL
if (member.isActive()) {
domains.add(new Domain(member.getMemberId(), member.getEffectiveTime(), member.isActive(), member.getReferencedComponentId(), getConstraint(member, "domainConstraint"), member.getAdditionalField("parentDomain"), getConstraint(member, "proximalPrimitiveConstraint"), member.getAdditionalField("proximalPrimitiveRefinement"), member.getAdditionalField("domainTemplateForPrecoordination"), member.getAdditionalField("domainTemplateForPostcoordination")));
}
}
timer.checkpoint("Load domains");
return domains;
}
use of org.snomed.snowstorm.core.data.services.pojo.MemberSearchRequest in project snowstorm by IHTSDO.
the class MRCMLoader method getAttributeDomains.
private List<AttributeDomain> getAttributeDomains(final String branchPath, final BranchCriteria branchCriteria, final TimerUtil timer) throws ServiceException {
List<ReferenceSetMember> attributeDomainMembers = memberService.findMembers(branchPath, branchCriteria, new MemberSearchRequest().referenceSet(Concepts.REFSET_MRCM_ATTRIBUTE_DOMAIN_INTERNATIONAL), LARGE_PAGE).getContent();
List<AttributeDomain> attributeDomains = new ArrayList<>();
for (ReferenceSetMember member : attributeDomainMembers) {
// grouped attributeCardinality attributeInGroupCardinality ruleStrengthId contentTypeId
if (member.isActive()) {
attributeDomains.add(new AttributeDomain(member.getMemberId(), member.getEffectiveTime(), member.isActive(), member.getReferencedComponentId(), member.getAdditionalField("domainId"), "1".equals(member.getAdditionalField("grouped")), new Cardinality(member.getAdditionalField("attributeCardinality")), new Cardinality(member.getAdditionalField("attributeInGroupCardinality")), RuleStrength.lookupByConceptId(member.getAdditionalField("ruleStrengthId")), ContentType.lookupByConceptId(member.getAdditionalField("contentTypeId"))));
}
}
timer.checkpoint("Load attribute domains");
return attributeDomains;
}
use of org.snomed.snowstorm.core.data.services.pojo.MemberSearchRequest in project snowstorm by IHTSDO.
the class MRCMLoader method getAttributeRanges.
private List<AttributeRange> getAttributeRanges(final String branchPath, final BranchCriteria branchCriteria, final TimerUtil timer) {
List<ReferenceSetMember> attributeRangeMembers = memberService.findMembers(branchPath, branchCriteria, new MemberSearchRequest().referenceSet(Concepts.REFSET_MRCM_ATTRIBUTE_RANGE_INTERNATIONAL), LARGE_PAGE).getContent();
List<AttributeRange> attributeRanges = new ArrayList<>();
for (ReferenceSetMember member : attributeRangeMembers) {
// id effectiveTime active moduleId refsetId referencedComponentId rangeConstraint attributeRule ruleStrengthId contentTypeId
if (member.isActive()) {
String rangeConstraint = member.getAdditionalField("rangeConstraint");
attributeRanges.add(new AttributeRange(member.getMemberId(), member.getEffectiveTime(), member.isActive(), member.getReferencedComponentId(), rangeConstraint, member.getAdditionalField("attributeRule"), RuleStrength.lookupByConceptId(member.getAdditionalField("ruleStrengthId")), ContentType.lookupByConceptId(member.getAdditionalField("contentTypeId")), getConcreteValueDataType(rangeConstraint)));
}
}
timer.checkpoint("Load attribute ranges");
return attributeRanges;
}
use of org.snomed.snowstorm.core.data.services.pojo.MemberSearchRequest in project snowstorm by IHTSDO.
the class UpgradeInactivationServiceTest method testFindAndUpdateInactivationIndicators.
@Test
void testFindAndUpdateInactivationIndicators() throws Exception {
// add content
Concept conceptA = testUtil.createConceptWithPathIdAndTermWithLang("MAIN", "100000", "Inactivation testing", "en");
// version
codeSystemService.createVersion(SNOMEDCT, Integer.valueOf("20200131"), "20200131 International Release");
// inactivate concept
conceptA = conceptService.find(conceptA.getConceptId(), MAIN);
Set<Description> descriptions = conceptA.getDescriptions();
assertNotNull(descriptions);
assertEquals(1, descriptions.size());
Description publishedDescription = descriptions.iterator().next();
Description unpublished = new Description("new term");
conceptA.addDescription(unpublished);
conceptA.setActive(false);
conceptService.update(conceptA, MAIN);
conceptA = conceptService.find(conceptA.getConceptId(), MAIN);
descriptions = conceptA.getDescriptions();
assertNotNull(descriptions);
assertEquals(2, descriptions.size());
Page<ReferenceSetMember> members = referenceSetMemberService.findMembers(MAIN, new MemberSearchRequest().referenceSet("900000000000490003"), PageRequest.of(0, 10));
assertNotNull(members);
assertEquals(2, members.getContent().size());
// delete description inactivation indicator members for testing
referenceSetMemberService.deleteMember(MAIN, members.getContent().get(0).getMemberId());
referenceSetMemberService.deleteMember(MAIN, members.getContent().get(1).getMemberId());
members = referenceSetMemberService.findMembers(MAIN, new MemberSearchRequest().referenceSet("900000000000490003").referencedComponentId(publishedDescription.getDescriptionId()), PageRequest.of(0, 10));
assertEquals(0, members.getContent().size());
upgradeInactivationService.findAndUpdateDescriptionsInactivation(SNOMEDCT);
members = referenceSetMemberService.findMembers(MAIN, new MemberSearchRequest().referenceSet("900000000000490003"), PageRequest.of(0, 10));
assertEquals(2, members.getContent().size());
// verify inactivation refset member
ReferenceSetMember inactivationMember = members.getContent().get(0);
assertNotNull(inactivationMember.getMemberId());
assertNull(inactivationMember.getEffectiveTime());
assertFalse(inactivationMember.isReleased());
assertTrue(inactivationMember.isActive());
assertEquals(publishedDescription.getModuleId(), inactivationMember.getModuleId());
assertEquals(Concepts.DESCRIPTION_INACTIVATION_INDICATOR_REFERENCE_SET, inactivationMember.getRefsetId());
assertEquals(Concepts.CONCEPT_NON_CURRENT, inactivationMember.getAdditionalField("valueId"));
assertEquals(publishedDescription.getDescriptionId(), inactivationMember.getReferencedComponentId());
assertEquals(publishedDescription.getConceptId(), inactivationMember.getConceptId());
// make sure published description is still active and published and unpublished description is deleted.
conceptA = conceptService.find(conceptA.getConceptId(), SNOMEDCT.getBranchPath());
List<Description> descriptionList = new ArrayList<>(conceptA.getDescriptions());
assertEquals(2, descriptionList.size());
assertTrue(descriptionList.get(0).isActive());
assertTrue(descriptionList.get(1).isActive());
}
use of org.snomed.snowstorm.core.data.services.pojo.MemberSearchRequest in project snowstorm by IHTSDO.
the class ExtensionAdditionalLanguageRefsetUpgradeServiceTest method setUp.
@BeforeEach
void setUp() throws Exception {
snomedct = new CodeSystem("SNOMEDCT", "MAIN");
codeSystemService.createCodeSystem(snomedct);
ReferenceSetMember enGbLanguageMember = new ReferenceSetMember(null, null, true, "900000000000207008", "900000000000508004", "675173018");
enGbLanguageMember.setAdditionalField(ReferenceSetMember.LanguageFields.ACCEPTABILITY_ID, "900000000000548007");
ReferenceSetMember enUsLanguageMember = new ReferenceSetMember(null, null, true, "900000000000207008", "900000000000509007", "675173018");
enUsLanguageMember.setAdditionalField(ReferenceSetMember.LanguageFields.ACCEPTABILITY_ID, "900000000000549004");
Concept concept = new Concept("123456");
Description description = new Description("675173018", "testing");
description.addLanguageRefsetMember(enGbLanguageMember);
description.addLanguageRefsetMember(enUsLanguageMember);
concept.addDescription(description);
conceptService.create(concept, snomedct.getBranchPath());
codeSystemService.createVersion(snomedct, 20190731, "2019-07-31 release");
ReferenceSetMember enGbLanguageMemberLatest = new ReferenceSetMember(null, null, true, "900000000000207008", "900000000000508004", "675173019");
enGbLanguageMemberLatest.setAdditionalField(ReferenceSetMember.LanguageFields.ACCEPTABILITY_ID, "900000000000548007");
ReferenceSetMember enUsLanguageMemberLatest = new ReferenceSetMember(null, null, true, "900000000000207008", "900000000000509007", "675173019");
enUsLanguageMemberLatest.setAdditionalField(ReferenceSetMember.LanguageFields.ACCEPTABILITY_ID, "900000000000549004");
Description latestDescription = new Description("675173019", "new term testing");
latestDescription.addLanguageRefsetMember(enGbLanguageMemberLatest);
latestDescription.addLanguageRefsetMember(enUsLanguageMemberLatest);
concept = conceptService.find("123456", snomedct.getBranchPath());
concept.addDescription(latestDescription);
concept = conceptService.update(concept, snomedct.getBranchPath());
// this is for testing complete copy as only active ones are copied.
Description existing = concept.getDescription("675173018");
ReferenceSetMember existingGbMember = existing.getLangRefsetMembersFirstValuesMap().get("900000000000508004");
existingGbMember.setActive(false);
referenceSetMemberService.updateMember("MAIN", existingGbMember);
assertEquals(1, concept.getDescription("675173018").getAcceptabilityMap().keySet().size());
MemberSearchRequest searchRequest = new MemberSearchRequest();
searchRequest.referenceSet("900000000000508004");
Page<ReferenceSetMember> updatedResult = referenceSetMemberService.findMembers(snomedct.getBranchPath(), searchRequest, PageRequest.of(0, 10));
assertNotNull(updatedResult);
assertEquals(2, updatedResult.getContent().size());
codeSystemService.createVersion(snomedct, 20200131, "2020-01-31 release");
snomedctNZ = new CodeSystem("SNOMEDCT-NZ", "MAIN/SNOMEDCT-NZ");
snomedctNZ.setDependantVersionEffectiveTime(20200131);
codeSystemService.createCodeSystem(snomedctNZ);
Map<String, Object> metaData = new HashMap<>();
metaData.put(BranchMetadataKeys.DEPENDENCY_PACKAGE, "International_Release.zip");
metaData.put(BranchMetadataKeys.PREVIOUS_PACKAGE, "NZExtension_Release.zip");
metaData.put("defaultModuleId", "21000210109");
metaData.put("defaultNamespace", "1000210");
metaData.put("shortname", "NZ");
final TypeReference<List<Map<String, String>>> listTypeReference = new TypeReference<>() {
};
List<Map<String, String>> requiredLanguageRefsets = objectMapper.readValue("[{\n" + " \"default\": \"false\",\n" + " \"en\": \"900000000000508004\",\n" + " \"readOnly\": \"true\",\n" + " \"dialectName\": \"en-gb\"\n" + " },\n" + " {\n" + " \"default\": \"true\",\n" + " \"en\": \"271000210107\",\n" + " \"dialectName\": \"en-nz\"\n" + " },\n" + " {\n" + " \"default\": \"false\",\n" + " \"mi\": \"291000210106\"\n" + " },\n" + " {\n" + " \"default\": \"false\",\n" + " \"en\": \"900000000000509007\",\n" + " \"dialectName\": \"en-us\"\n" + " }\n" + " ]", listTypeReference);
metaData.put("requiredLanguageRefsets", requiredLanguageRefsets);
branchService.updateMetadata("MAIN/SNOMEDCT-NZ", metaData);
}
Aggregations