File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 workflow_dispatch :
55 pull_request :
66 paths :
7- - .
7+ - ' ** '
88 - .github/workflows/omop-case-reports.yml
99
1010env :
Original file line number Diff line number Diff line change 1- import { Client } from '@elastic/elasticsearch' ;
2- const isDev = process . env . NODE_ENV === 'development' ;
3- export const es = new Client ( {
4- node : process . env . ELASTICSEARCH_URL ,
5- auth : {
6- username : process . env . ELASTICSEARCH_USERNAME ! ,
7- password : process . env . ELASTICSEARCH_PASSWORD ! ,
8- } ,
9- tls : isDev
10- ? { rejectUnauthorized : false }
11- : undefined ,
12- } ) ;
1+ import { Client } from "@elastic/elasticsearch" ;
2+ const isDev = process . env . NODE_ENV === "development" ;
3+
4+ export function getElasticClient ( ) {
5+ return new Client ( {
6+ node : process . env . ELASTICSEARCH_URL ,
7+ auth : {
8+ username : process . env . ELASTICSEARCH_USERNAME ! ,
9+ password : process . env . ELASTICSEARCH_PASSWORD ! ,
10+ } ,
11+ tls : isDev ? { rejectUnauthorized : false } : undefined ,
12+ } ) ;
13+ }
Original file line number Diff line number Diff line change 1- import { es } from "@/lib/elasticsearch" ;
1+ import { getElasticClient } from "@/lib/elasticsearch" ;
22
33export async function getConcepts ( domain ?: string ) {
44 const must : any [ ] = [ ] ;
55
66 if ( domain && domain !== "All" ) {
77 must . push ( { term : { "domain.keyword" : domain } } ) ;
88 }
9-
10- const result = await es . search ( {
9+
10+ const result = await getElasticClient ( ) . search ( {
1111 index : "notes_nlp" ,
1212 size : 0 ,
1313 query : {
@@ -41,7 +41,7 @@ export async function getConcepts(domain?: string) {
4141}
4242
4343export async function getNotesForConcept ( conceptId : string ) {
44- const resultConcept = await es . search ( {
44+ const resultConcept = await getElasticClient ( ) . search ( {
4545 index : "notes_nlp" ,
4646 size : 100 ,
4747 query : {
@@ -56,7 +56,7 @@ export async function getNotesForConcept(conceptId: string) {
5656
5757 if ( noteIds . length === 0 ) return [ ] ;
5858
59- const notes = await es . search ( {
59+ const notes = await getElasticClient ( ) . search ( {
6060 index : "notes" ,
6161 size : 100 ,
6262 query : {
You can’t perform that action at this time.
0 commit comments