From 28a2299365b3be8ad31829268f2e80f3111cf9f0 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Wed, 15 May 2024 03:13:05 -0700 Subject: [PATCH] Fix Swiftlint --- OwnYourData/ClinicalTrials/NCITrialsModel.swift | 4 ++-- .../LLMFunctions/GetTrialsLLMFunction.swift | 8 +++----- OwnYourData/TrialsMatching/MatchingModule.swift | 9 ++------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/OwnYourData/ClinicalTrials/NCITrialsModel.swift b/OwnYourData/ClinicalTrials/NCITrialsModel.swift index 31b6aaf..ba1cce8 100644 --- a/OwnYourData/ClinicalTrials/NCITrialsModel.swift +++ b/OwnYourData/ClinicalTrials/NCITrialsModel.swift @@ -14,7 +14,7 @@ import SpeziLocation @Observable class NCITrialsModel { #warning("Insert NIC Token here to test the app.") - private static let apiKey: String = "tkMGxBkgOC4TDCUfjcPdw7eeZsuuZual632WpUnH" + private static let apiKey: String = "" private let locationModule: SpeziLocation @@ -72,7 +72,7 @@ class NCITrialsModel { OpenAPIClientAPI.customHeaders = ["X-API-KEY": Self.apiKey] CodableHelper.dateFormatter = NICTrialsAPIDateFormatter() - let keywords = keywords.filter({ !$0.isEmpty }) + let keywords = keywords.filter { !$0.isEmpty } return try await withCheckedThrowingContinuation { continuation in TrialsAPI.searchTrialsByGet( diff --git a/OwnYourData/TrialsMatching/LLMFunctions/GetTrialsLLMFunction.swift b/OwnYourData/TrialsMatching/LLMFunctions/GetTrialsLLMFunction.swift index 4b9becd..0bea568 100644 --- a/OwnYourData/TrialsMatching/LLMFunctions/GetTrialsLLMFunction.swift +++ b/OwnYourData/TrialsMatching/LLMFunctions/GetTrialsLLMFunction.swift @@ -28,12 +28,10 @@ struct GetTrialsLLMFunction: LLMFunction { nciTrialsModel: NCITrialsModel ) { self.nciTrialsModel = nciTrialsModel - - print(nciTrialsModel.trials.compactMap({ $0.llmIdentifier })) - + _trailIdentifiers = Parameter( description: String(localized: "LLM_GET_TRIALS_PARAMETER_DESCRIPTION"), - enum: nciTrialsModel.trials.compactMap({ $0.llmIdentifier }) + enum: nciTrialsModel.trials.compactMap { $0.llmIdentifier } ) } @@ -48,7 +46,7 @@ struct GetTrialsLLMFunction: LLMFunction { Title: \(trial.briefTitle ?? "") (\(trial.officialTitle ?? "")) Description: \(trial.detailDescription ?? "") - Incluision Criteria: \(trial.eligibility?.unstructured?.compactMap({ $0.description }).joined() ?? "") + Incluision Criteria: \(trial.eligibility?.unstructured?.compactMap { $0.description }.joined() ?? "") """ } } diff --git a/OwnYourData/TrialsMatching/MatchingModule.swift b/OwnYourData/TrialsMatching/MatchingModule.swift index a41bf1c..b6234db 100644 --- a/OwnYourData/TrialsMatching/MatchingModule.swift +++ b/OwnYourData/TrialsMatching/MatchingModule.swift @@ -74,12 +74,7 @@ class MatchingModule: Module, EnvironmentAccessible, DefaultInitializable { } let matchingTrialIds = try await trialsIdentificaiton() - print(matchingTrialIds) - print(nciTrialsModel.trials.map({ $0.llmIdentifier })) - - matchingTrials = nciTrialsModel.trials.filter({ trial in matchingTrialIds.contains(where: { $0 == trial.llmIdentifier }) }) - - print(matchingTrials) + matchingTrials = nciTrialsModel.trials.filter { trial in matchingTrialIds.contains(where: { $0 == trial.llmIdentifier }) } withAnimation { self.state = .idle @@ -118,7 +113,7 @@ class MatchingModule: Module, EnvironmentAccessible, DefaultInitializable { output.append(token) } - keywords = output.components(separatedBy: ",").flatMap({ $0.components(separatedBy: " ") }).filter({ !$0.isEmpty }) + keywords = output.components(separatedBy: ",").flatMap { $0.components(separatedBy: " ") }.filter { !$0.isEmpty } return keywords }