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

Write tests for GetVisitConcept #40

Closed
github-actions bot opened this issue Nov 6, 2022 · 0 comments
Closed

Write tests for GetVisitConcept #40

github-actions bot opened this issue Nov 6, 2022 · 0 comments
Assignees
Labels
good first issue Good for newcomers tests Testing of functions or features todo Bot-added TODO

Comments

@github-actions
Copy link

github-actions bot commented Nov 6, 2022

Only needs one or two tests; should have everything that is required in Eunomia to run!

#= TODO: Write tests for GetVisitConcept

end

#= TODO: Write tests for GetVisitConcept
Only needs one or two tests; should have everything that is required in Eunomia to run!
labels: tests, good first issue
assignees: VarshC
=#
"""
GetVisitConcept(visit_ids, conn; tab = visit_occurrence)

Given a list of visit IDs, find their corresponding visit_concept_id's.

# Arguments:

- `visit_ids` - list of `visit_id`'s; each ID must be of subtype `Integer`

- `conn` - database connection using DBInterface

# Keyword Arguments:

- `tab` - the `SQLTable` representing the Condition Occurrence table; default `visit_occurrence`

# Returns

- `df::DataFrame` - a two column `DataFrame` comprised of columns: `:visit_occurrence_id` and `:visit_concept_id`
"""
function GetVisitConcept(
    visit_ids,
    conn;
    tab=visit_occurrence
)

    df = DBInterface.execute(conn, GetVisitConcept(visit_ids; tab=tab)) |> DataFrame

    return df

end

"""
GetVisitConcept(visit_ids; tab = visit_occurrence)

Produces SQL statement that, given a list of visit IDs, find their corresponding visit_concept_id's.

# Arguments:

- `visit_ids` - list of `visit_id`'s; each ID must be of subtype `Integer`

# Keyword Arguments:

- `tab` - the `SQLTable` representing the Condition Occurrence table; default `visit_occurrence`

# Returns

- `sql::String` - Prepared SQL statement as a `String`
"""
function GetVisitConcept(
    visit_ids;
    tab=visit_occurrence
)

    sql =
        From(tab) |>
        Where(Fun.in(Get.visit_occurrence_id, visit_ids...)) |>
        Select(Get.visit_occurrence_id, Get.visit_concept_id) |>
        q -> render(q, dialect=dialect)

    return String(sql)

end

export GetDatabasePersonIDs, GetPatientState, GetPatientGender, GetPatientRace, GetPatientAgeGroup, GetPatientVisits, GetMostRecentConditions, GetMostRecentVisit, GetVisitCondition, GetPatientEthnicity, GetDatabaseYearRange, GetVisitPlaceOfService, GetVisitConcept
@github-actions github-actions bot added good first issue Good for newcomers tests Testing of functions or features todo Bot-added TODO labels Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers tests Testing of functions or features todo Bot-added TODO
Projects
None yet
Development

No branches or pull requests

2 participants