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

Read SQL Server #2956

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

Read SQL Server #2956

wants to merge 24 commits into from

Conversation

JNygaard-Skylight
Copy link
Collaborator

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

PULL REQUEST

Summary

If using SQL Server as the metadata database, the eCR Table can now read from it.

Related Issue

Fixes #2946

Acceptance Criteria

  • Modify listEcrData service to retrieve the necessary metadata from SQL Server to populate the eCR Library table (from ecr_data, ecr_rr_conditions, ecr_rr_rule_summaries) (the same way it does for Postgres)
    • Add logic to select the correct db source (Postgres or SQL Server) based on the env var MEATADATA_DATABASE_TYPE
  • Add tests

Additional Information

You will need the following variables in your .env.local:

METADATA_DATABASE_TYPE=sqlserver
METADATA_DATABASE_SCHEMA=extended
SQL_SERVER_USER=sa
SQL_SERVER_PASSWORD=Password1!
SQL_SERVER_HOST=sqlserver # Use this for running the seed data script and when you are running the ecr-viewer in a container
# SQL_SERVER_HOST=localhost # Use this for running the ecr-viewer locally

Also to run the seed data script with SQL Server you will need to change the Orchestration config to use the philly_ecr.json message-parser configuation. E.g.:

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

Checklist

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

if (!searchTerm) {
return "NULL IS NULL";
}
return `${field} LIKE '${searchTerm}'`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

As it is currently, we are only matching on whole words for first and last name.
image
image

Suggested change
return `${field} LIKE '${searchTerm}'`;
return `${field} LIKE '%${searchTerm}%'`;

import {
convertUTCToLocalString,
formatDate,
formatDateTime,
} from "../../services/formatService";
} from "../services/formatService";
import { database } from "../api/services/postgres_db";

describe("listEcrDataService", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we get some tests here that hit the sqlserver code path? Everything being tested here is for postgres.

@austin-hall-skylight
Copy link
Collaborator

I was able to get the metadata to save correctly by adding "include_metadata": "true" to the params in the suggested orchestration config changes:

    {
      "name": "metadata_values",
      "service": "message_parser",
      "endpoint": "/parse_message",
      "params": {
        "message_format": "fhir",
        "parsing_schema_name": "philly_ecr.json",
        "include_metadata": "true"
      }
    },

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.

Add functionality to read core metadata from SQL Server
3 participants