Skip to content

Commit

Permalink
Updated folders, CMakefile, and packager to work with updated dev_con…
Browse files Browse the repository at this point in the history
…tainer script.

Signed-off-by: M Q <[email protected]>
  • Loading branch information
MMelQin committed Oct 25, 2024
1 parent 518e1c4 commit 0b83470
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 75 deletions.
2 changes: 1 addition & 1 deletion applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ add_holohub_application(webrtc_video_server)

add_subdirectory(orsi)
add_subdirectory(nvidia_nim)
add_subdirectory(ehr_query_llm/domain_specific/fhir)
add_subdirectory(ehr_query_llm)
20 changes: 20 additions & 0 deletions applications/ehr_query_llm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.20)
project(ehr_query_llm LANGUAGES NONE)

add_holohub_application(fhir)
add_holohub_application(llm)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

cmake_minimum_required(VERSION 3.20)
project(ehr_query_llm/domain_specific/fhir NONE)
project(fhir LANGUAGES NONE)

# Install application and dependencies into the install/ directory for packaging
install(
Expand All @@ -27,10 +27,10 @@ install(
requirements.txt
run_cmd_template.sh
test_fhir_client.py
DESTINATION fhir
DESTINATION bin/fhir/python
COMPONENT "holohub-apps"
)

install(
DIRECTORY ${CMAKE_HOME_DIRECTORY}/operators/ehr_query_llm
DESTINATION fhir/operators)
DESTINATION bin/fhir/python/operators)
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ RUN apt update \
RUN if ! grep -q "VERSION_ID=\"22.04\"" /etc/os-release; then \
pip install setuptools; \
fi
COPY applications/ehr_query_llm/domain_specific/fhir/requirements.txt /tmp/requirements.txt
COPY applications/ehr_query_llm/fhir/requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Error processing line 1 of /usr/local/lib/python3.10/dist-packages/holoscan-2.4.

This is a step wise way to run the application in a dev container.
```bash
$ ./dev_container build --docker_file applications/ehr_query_llm/domain_specific/fhir/Dockerfile --img holoscan:fhir --verbose --no-cache
./dev_container build --docker_file applications/ehr_query_llm/fhir/Dockerfile --img holoscan:fhir --verbose --no-cache
```

Optionally check the newly built image
Expand All @@ -78,7 +78,7 @@ holoscan fhir 508140b8d446 3 minutes ago 14.1GB

Launch the container
```bash
$ ./dev_container launch --img holoscan:fhir --as_root
./dev_container launch --img holoscan:fhir --as_root
```

Now in the container, build and run the application
Expand All @@ -102,9 +102,9 @@ For a Python application, building and launching the dev container can be comple
First create and activate a Python virtual environment, followed with installing the dependencies

```bash
python3 -m venv testenv
source testenv/bin/activate
pip install -r applications/ehr_query_llm/domain_specific/fhir/requirements.txt
python3 -m venv .testenv
source .testenv/bin/activate
pip install -r applications/ehr_query_llm/fhir/requirements.txt
```

Build and install the application with `dev_container`
Expand All @@ -114,23 +114,23 @@ Build and install the application with `dev_container`

Now, run the application which is _installed_ in the `install` folder, with server URLs and credential of your own
```bash
python install/fhir --fhir_url <f_url> --auth_url <a_url> --uid <id> --secret <token>
python install/bin/fhir/python/ --fhir_url <f_url> --auth_url <a_url> --uid <id> --secret <token>
```

### Test the Running Application

Once the FHIR application has been started with one of the ways, a test application can be used to request and receive FHIR resources, namely `applications/ehr_query_llm/domain_specific/fhir/test_fhir_client.py`.
Once the FHIR application has been started with one of the ways, a test application can be used to request and receive FHIR resources, namely `applications/ehr_query_llm/fhir/test_fhir_client.py`.

The test application contains hard coded patient name, patient FHIR resource ID, etc., corresponding to a specific test dataset, though can be easily modified for another dataset.

It is strongly recommended to run this test application in a Python virtual environment, which can be the same as in running the FHIR application. The following describes running it in its own environment.

```bash
python3 -m venv testenv
source testenv/bin/activate
echo "Assuming venv already created with `python3 -m venv .testenv`"
source .testenv/bin/activate
pip install -r applications/ehr_query_llm/domain_specific/fhir/requirements.txt
export PYTHONPATH=${PWD}
python applications/ehr_query_llm/domain_specific/fhir/test_fhir_client.py
python applications/ehr_query_llm/fhir/test_fhir_client.py
```

From the menu, pick one of the choices for the resources of interest.
Expand All @@ -141,7 +141,7 @@ With Holoscan CLI, an applications built with Holoscan SDK can be packaged into

This example application provides all the necessary contents for HAP packaging. It is required to perform the packaging in a Python virtual environment, with the application's dependencies installed, before running the following script to reveal specific packaging commands.
```bash
applications/ehr_query_llm/domain_specific/fhir/packageHAP.sh
applications/ehr_query_llm/fhir/packageHAP.sh
```

Once the HAP is created, it can then be saved and restored on the target deployment host, and run with `docker run` command, shown below with to be substituted user specific parameters.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set -e

GIT_ROOT=$(readlink -f ./$(git rev-parse --show-cdup))
APP_PATH="$GIT_ROOT/install/fhir"
APP_PATH="$GIT_ROOT/install/bin/fhir/python"
APP_CONFIG="app.yaml"
APP_NAME="fhir"
IMAGE_TAG="holohub-fhir"
Expand Down
58 changes: 0 additions & 58 deletions applications/ehr_query_llm/metadata.json

This file was deleted.

1 change: 1 addition & 0 deletions operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ add_holohub_operator(xr_basic_render)
add_holohub_operator(XrFrameOp)
add_holohub_operator(XrTransformOp)
add_holohub_operator(yuan_qcap DEPENDS EXTENSIONS yuan_qcap)
add_holohub_operator(ehr_query_llm)


# install
Expand Down
18 changes: 18 additions & 0 deletions operators/ehr_query_llm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.20)
project(ehr_query_lmm)

# No much to do for Python modules and all of them are to be used.

0 comments on commit 0b83470

Please sign in to comment.