Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditions Endpoint #2934

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conditions Endpoint #2934

wants to merge 6 commits into from

Conversation

JNygaard-Skylight
Copy link
Collaborator

@JNygaard-Skylight JNygaard-Skylight commented Nov 19, 2024

PULL REQUEST

Summary

Adds /api/conditions endpoint to get a list of the conditions in ecr-viewer. This returns a list of condition names found in the ecr_rr_conditions table.

Related Issue

Fixes #2749

Acceptance Criteria

  • Backend query available to gather all unique conditions across our eCR storage
    • Query works for core schema
    • Query works for extended schema
  • Endpoint so that frontend can use this query should also be included

Additional Information

To test with Postgres and the core metadata schema you'll need the following variables in your .env.local:

# METADATA_DATABASE_TYPE=postgres
# METADATA_DATABASE_SCHEMA=core

And for SQL Server and the extended metadata schema:

METADATA_DATABASE_TYPE=sqlserver
METADATA_DATABASE_SCHEMA=extended
SQL_SERVER_USER=sa
SQL_SERVER_PASSWORD=Password1!
SQL_SERVER_HOST=sqlserver

In addition, to populate SQL Server you will need to modify the orchestration configs (save-bundle-to-ecr-viewer.json, and save-eicr-to-ecr-viewer-config.json) the seed data script uses to use the philly_ecr.json message-parser config. E.g.:

⋮
    {
      "name": "metadata_values",
      "service": "message_parser",
      "endpoint": "/parse_message",
      "params": {
        "message_format": "fhir",
        "parsing_schema_name": "philly_ecr.json",
        "credential_manager": "azure"
      }
⋮

Checklist

  • If this code affects the other scrum team, have they been notified? (In Slack, as reviewers, etc.)

Copy link
Collaborator

@mcmcgrath13 mcmcgrath13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not super familiar with the part of the code base, so just commenting

Copy link
Collaborator

@BobanL BobanL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but just a couple of small nits.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of copying this file here, can we update the docker-compose to copy the real one? I believe you'll need to update test_type_system and test_result_qualitative in that one too.

- ./sql/extended.sql:/var/opt/mssql/scripts/extended.sql

case "sqlserver":
return await get_conditions_sqlserver();
default:
return NextResponse.json({ message: "Invalid source" }, { status: 500 });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we have another variable called "source", could we update this error to specifically say Invalid metadata database type?

Comment on lines +39 to +46
let pool = await sql.connect({
user: process.env.SQL_SERVER_USER,
password: process.env.SQL_SERVER_PASSWORD,
server: process.env.SQL_SERVER_HOST || "localhost",
options: {
trustServerCertificate: true,
},
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we initialize this connection in this file and in save-fhir-data-service.ts can we just pull this out into a single file like we do for postgres?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FILTER: Query for all unique conditions
3 participants