Skip to content

Commit

Permalink
Merge pull request #40 from jsteinhafel/feature/IKDT-641-Snomed-Start…
Browse files Browse the repository at this point in the history
…er-Data-With-Composeer

Feature/ikdt 641 snomed starter data with composeer
  • Loading branch information
jsteinhafel authored Oct 1, 2024
2 parents ec3b54b + 88debf9 commit 92d1b07
Showing 1 changed file with 100 additions and 0 deletions.
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();
}

}

0 comments on commit 92d1b07

Please sign in to comment.