-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from jsteinhafel/feature/IKDT-641-Snomed-Start…
…er-Data-With-Composeer Feature/ikdt 641 snomed starter data with composeer
- Loading branch information
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/main/java/dev/ikm/tinkar/starterdata/SnomedStarterDataComposer.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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package dev.ikm.tinkar.starterdata; | ||
|
||
import dev.ikm.tinkar.common.service.CachingService; | ||
import dev.ikm.tinkar.common.service.PrimitiveData; | ||
import dev.ikm.tinkar.common.service.ServiceKeys; | ||
import dev.ikm.tinkar.common.service.ServiceProperties; | ||
import dev.ikm.tinkar.common.util.uuid.UuidUtil; | ||
import dev.ikm.tinkar.composer.Composer; | ||
import dev.ikm.tinkar.composer.Session; | ||
import dev.ikm.tinkar.composer.assembler.ConceptAssembler; | ||
import dev.ikm.tinkar.composer.template.*; | ||
import dev.ikm.tinkar.terms.EntityProxy; | ||
import dev.ikm.tinkar.terms.State; | ||
import dev.ikm.tinkar.terms.TinkarTerm; | ||
|
||
import java.io.File; | ||
|
||
import static dev.ikm.tinkar.terms.TinkarTerm.DESCRIPTION_NOT_CASE_SENSITIVE; | ||
import static dev.ikm.tinkar.terms.TinkarTerm.ENGLISH_LANGUAGE; | ||
public class SnomedStarterDataComposer { | ||
public static void main(String[] args) { | ||
new SnomedStarterDataComposer().buildSnomedStarterData(); | ||
} | ||
|
||
private void buildSnomedStarterData() { | ||
File datastore = new File("/Users/jsteinhafel/Solor/generated-data"); | ||
|
||
CachingService.clearAll(); | ||
ServiceProperties.set(ServiceKeys.DATA_STORE_ROOT, datastore); | ||
PrimitiveData.selectControllerByName("Open SpinedArrayStore"); | ||
PrimitiveData.start(); | ||
|
||
Composer composer = new Composer("Snomed Starter Data Composer"); | ||
|
||
UUIDUtility uuidUtility = new UUIDUtility(); | ||
|
||
Session session = composer.open(State.ACTIVE, | ||
TinkarTerm.USER, | ||
TinkarTerm.PRIMORDIAL_MODULE, | ||
TinkarTerm.PRIMORDIAL_PATH); | ||
|
||
EntityProxy.Concept snomedAuthor = EntityProxy.Concept.make("IHTSDO SNOMED CT Author", uuidUtility.createUUID("IHTSDO SNOMED CT Author")); | ||
session.compose((ConceptAssembler concept) -> concept | ||
.concept(snomedAuthor) | ||
.attach((FullyQualifiedName fqn) -> fqn | ||
.language(ENGLISH_LANGUAGE) | ||
.text("IHTSDO SNOMED CT Author") | ||
.caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) | ||
) | ||
.attach((Synonym synonym)-> synonym | ||
.language(ENGLISH_LANGUAGE) | ||
.text("SNOMED CT Author") | ||
.caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) | ||
) | ||
.attach((Definition definition) -> definition | ||
.language(ENGLISH_LANGUAGE) | ||
.text("International Health Terminology Standards Development Organisation (IHTSDO) SNOMED CT Author") | ||
.caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) | ||
) | ||
.attach((Identifier identifier) -> identifier | ||
.source(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER) | ||
.identifier(snomedAuthor.asUuidArray()[0].toString()) | ||
) | ||
.attach((StatedAxiom statedAxiom) -> statedAxiom | ||
.isA(TinkarTerm.USER) | ||
) | ||
); | ||
|
||
EntityProxy.Concept snomedIdentifier = EntityProxy.Concept.make("SNOMED CT Identifier", UuidUtil.fromSNOMED("900000000000294009")); | ||
session.compose((ConceptAssembler concept) -> concept | ||
.concept(snomedIdentifier) | ||
.attach((FullyQualifiedName fqn) -> fqn | ||
.language(ENGLISH_LANGUAGE) | ||
.text("SNOMED CT Identifier") | ||
.caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) | ||
) | ||
.attach((Synonym synonym)-> synonym | ||
.language(ENGLISH_LANGUAGE) | ||
.text("SCTID") | ||
.caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) | ||
) | ||
.attach((Definition definition) -> definition | ||
.language(ENGLISH_LANGUAGE) | ||
.text("Unique point of origin for identifier") | ||
.caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) | ||
) | ||
.attach((Identifier identifier) -> identifier | ||
.source(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER) | ||
.identifier(snomedIdentifier.asUuidArray()[0].toString()) | ||
) | ||
.attach((StatedAxiom statedAxiom) -> statedAxiom | ||
.isA(TinkarTerm.IDENTIFIER_SOURCE) | ||
) | ||
); | ||
|
||
composer.commitSession(session); | ||
PrimitiveData.stop(); | ||
} | ||
|
||
} |