Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,23 @@ public Integer call() throws Exception {
FhirContext fhirContext = FhirContext.forCached(fhirVersionEnum);

IGContext igContext = null;
NpmProcessor npmProcessor = null;
if (rootDir != null && igPath != null) {
igContext = new IGContext(new Logger());
igContext.initializeFromIg(rootDir, igPath, toVersionNumber(fhirVersionEnum));
} else if (parentCommand != null && parentCommand.getIgContextManager() != null && rootDir != null) {
var npmProcessor = parentCommand
npmProcessor = parentCommand
.getIgContextManager()
.getContext(Uris.addPath(Uris.addPath(URI.create(rootDir), "input"), "cql"));
if (npmProcessor != null) {
igContext = npmProcessor.getIgContext();
}
}

if (npmProcessor == null) {
npmProcessor = new NpmProcessor(igContext);
}

CqlOptions cqlOptions = CqlOptions.defaultOptions();

if (optionsPath != null) {
Expand All @@ -205,24 +210,21 @@ public Integer call() throws Exception {
evaluationSettings.setCqlOptions(cqlOptions);
evaluationSettings.setTerminologySettings(terminologySettings);
evaluationSettings.setRetrieveSettings(retrieveSettings);
evaluationSettings.setNpmProcessor(new NpmProcessor(igContext));
evaluationSettings.setNpmProcessor(npmProcessor);

for (LibraryParameter library : libraries) {
// Paths are mixed types
// IgStandardRepository used java nio path objects
// DefaultLibraryServiceProvider used kotlin path objects
// Until the language server can be ported to kotlin, the differences will exist
var libraryKotlinPath = library.libraryUrl != null
? Path(Uris.parseOrNull(library.libraryUrl).toURL().getPath())
: null;
var libraryUri = library.libraryUrl != null ? Uris.parseOrNull(library.libraryUrl) : null;

var libraryKotlinPath = libraryUri != null ? Path(libraryUri.toURL().getPath()) : null;

var modelPath = library.model != null
? Paths.get(Uris.parseOrNull(library.model.modelUrl).toURL().getPath())
: null;
var modelPath = library.model != null ? Paths.get(Uris.parseOrNull(library.model.modelUrl)) : null;

var terminologyPath = library.terminologyUrl != null
? Paths.get(Uris.parseOrNull(library.terminologyUrl).toURL().getPath())
: null;
var terminologyPath =
library.terminologyUrl != null ? Paths.get(Uris.parseOrNull(library.terminologyUrl)) : null;

var repository = createRepository(fhirContext, terminologyPath, modelPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ protected CqlCompilerOptions readOptions(URI rootUri) {

CqlCompilerOptions options = null;

InputStream input = contentService.read(Uris.addPath(rootUri, "/cql-options.json"));
var optionsUri = Uris.addPath(rootUri, "/cql-options.json");
InputStream input = contentService.read(optionsUri);

if (input != null) {
// TODO: Why is this using fromFile and not fromSource?
options = CqlTranslatorOptions.fromFile(Path("/cql-options.json")).getCqlCompilerOptions();
} else {
log.info("cql-options.json not found, using default options");
log.info(String.format("%s not found, using default options", optionsUri.toString()));
options = CqlTranslatorOptions.defaultOptions().getCqlCompilerOptions();
}

Expand Down