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
41 changes: 41 additions & 0 deletions helm-charts/cogstack-ce-helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,47 @@ Create the name of the service account to use
Dependency URLs
*/}}


{{- define "medcat-service.service-name" -}}
{{ include "medcat-service.fullname" (dict "Values" .Values "Chart" (dict "Name" "medcat-service") "Release" .Release ) }}
{{- end -}}

{{- define "medcat-service.port" -}}
{{ index .Values "medcat-service" "service" "port" }}
{{- end -}}

{{- define "medcat-service.url" -}}
{{- $url := (index .Values "medcat-service" "url") | default "" -}}
{{- if $url -}}
{{ $url }}
{{- else if not (index .Values "medcat-service" "enabled") -}}
"unset"
{{- else -}}
http://{{ include "medcat-service.service-name" . }}:{{ include "medcat-service.port" . }}
{{- end -}}
{{- end -}}

{{- define "anoncat-service.service-name" -}}
{{ include "medcat-service.fullname" (dict "Values" (index .Values "anoncat-service") "Chart" (dict "Name" "anoncat-service") "Release" .Release ) }}
{{- end -}}

{{- define "anoncat-service.port" -}}
{{ index .Values "anoncat-service" "service" "port" }}
{{- end -}}

{{- define "anoncat-service.url" -}}
{{- $url := (index .Values "anoncat-service" "url") | default "" -}}
{{- if $url -}}
{{ $url }}
{{- else if not (index .Values "anoncat-service" "enabled") -}}
"unset"
{{- else -}}
http://{{ include "anoncat-service.service-name" . }}:{{ include "anoncat-service.port" . }}
{{- end -}}
{{- end -}}



{{- define "opensearch.url" -}}
{{- if .Values.opensearch.enabled }}
{{- $serviceName := include "opensearch.serviceName" (index .Subcharts "opensearch") -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: cogstack-ce-helm-jupyterhub-config
data:
MEDCAT_SERVICE_URL: {{ include "medcat-service.url" . }}
ANONCAT_SERVICE_URL: {{ include "anoncat-service.url" . }}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data:
description: "Example project for medcat trainer using MedCAT Service"
annotationGuidelineLink: "https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing"
useModelService: true
modelServiceUrl: "http://{{ include "cogstack-ce-helm.fullname" . }}-medcat-service:5000"
modelServiceUrl: {{ include "medcat-service.url" . }}
- dataset:
name: "Example Dataset - psych.csv - deid"
url: "https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv"
Expand All @@ -25,5 +25,5 @@ data:
description: "Example project for medcat trainer using AnonCAT Service"
annotationGuidelineLink: "https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing"
useModelService: true
modelServiceUrl: "http://{{ include "cogstack-ce-helm.fullname" . }}-anoncat-service:5000"
modelServiceUrl: {{ include "anoncat-service.url" . }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: opensearch-provisioning-config
name: {{ include "cogstack-ce-helm.fullname" . }}-opensearch-provisioning-config
data:
{{ (.Files.Glob "provisioning/*").AsConfig | indent 2 }}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ spec:
volumes:
- name: opensearch-provisioning-config
configMap:
name: opensearch-provisioning-config
name: {{ include "cogstack-ce-helm.fullname" . }}-opensearch-provisioning-config
{{- end }}
12 changes: 12 additions & 0 deletions helm-charts/cogstack-ce-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,15 @@ cogstack-jupyterhub:
tag: "2.2.2"
# -- JupyterHub singleuser image pull policy.
pullPolicy: IfNotPresent
extraEnv:
MEDCAT_SERVICE_URL:
valueFrom:
configMapKeyRef:
name: cogstack-ce-helm-jupyterhub-config
key: MEDCAT_SERVICE_URL
ANONCAT_SERVICE_URL:
name: ANONCAT_SERVICE_URL
valueFrom:
configMapKeyRef:
name: cogstack-ce-helm-jupyterhub-config
key: ANONCAT_SERVICE_URL
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": null,
"id": "17deaa5c",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -77,7 +77,7 @@
"sample_text = \"John was diagnosed with Kidney Failure\"\n",
"\n",
"# Service URLs from environment variables\n",
"medcat_base_url = os.getenv(\"MEDCAT_URL\", \"http://cogstack-medcat-service:5000\").rstrip(\"/\")\n",
"medcat_base_url = os.getenv(\"MEDCAT_SERVICE_URL\", \"http://cogstack-medcat-service:5000\").rstrip(\"/\")\n",
"medcat_url = medcat_base_url + \"/api/process\"\n",
"\n",
"opensearch_url = os.getenv(\"OPENSEARCH_URL\", \"https://opensearch-cluster-master:9200\")\n",
Expand Down Expand Up @@ -107,7 +107,8 @@
"annotations_index = \"discharge_annotations\"\n",
"\n",
"# Static demo note id used across all steps\n",
"note_id = \"demo-note-kidney-failure-001\""
"note_id = \"demo-note-kidney-failure-001\"\n",
"subject_id = 1"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
"sample_text = \"John was diagnosed with Kidney Failure\"\n",
"\n",
"medcat_base_url = os.getenv(\n",
" \"MEDCAT_URL\", \"http://cogstack-medcat-service:5000\"\n",
" \"MEDCAT_SERVICE_URL\", \"http://cogstack-medcat-service:5000\"\n",
").rstrip(\"/\")\n",
"\n",
"anoncat_base_url = os.getenv(\n",
" \"ANONCAT_URL\", \"http://cogstack-ce-anoncat-service:5000\"\n",
" \"ANONCAT_SERVICE_URL\", \"http://cogstack-ce-anoncat-service:5000\"\n",
").rstrip(\"/\")\n",
"\n",
"medcat_url = medcat_base_url + \"/api/process\"\n",
Expand Down
11 changes: 6 additions & 5 deletions helm-charts/cogstack-jupyterhub-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ jupyterhub:
c.Application.log_level = 'DEBUG'
00-custom-spawner: |
# Custom environment variables for user pods
c.KubeSpawner.environment = {
'GRANT_SUDO': '1',
'CHOWN_HOME': 'yes',
'CHOWN_HOME_OPTS': '-R',
}
c.KubeSpawner.environment = c.KubeSpawner.environment or {}
c.KubeSpawner.environment.update({
'GRANT_SUDO': '1',
'CHOWN_HOME': 'yes',
'CHOWN_HOME_OPTS': '-R',
})
# Allow root in notebooks
c.KubeSpawner.args = ['--allow-root']
proxy:
Expand Down
9 changes: 8 additions & 1 deletion helm-charts/local_dev_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ helm test medcat-service --logs

## helm install trainer-registry oci://registry-1.docker.io/cogstacksystems/medcat-trainer-helm --wait --timeout 5m0s

helm upgrade cogstack-ce-helm ./cogstack-ce-helm --install
# Run cogstack-ce-helm

helm repo add opensearch https://opensearch-project.github.io/helm-charts/
helm dependency update ./medcat-trainer-helm
helm dependency update ./cogstack-jupyterhub-helm
helm dependency update ./cogstack-ce-helm

helm upgrade cogstack-ce-helm ./cogstack-ce-helm --install --dependency-update --wait --timeout 30m0s

# Stop any running port forwards
# ps -ef | grep '[p]ort-forward' | awk '{print $2}' | xargs -r kill
Expand Down
Loading