Skip to content

"levelOfSupervision" field in VisitReports table gets nulled when reports are approved #72

@gregorp

Description

@gregorp

In the VisitReports table, the levelOfSupervision field gets nulled unexpectedly in a new version when the state changes to 'approved'. Heres a couple sample visit reports:

select id, "versionCreatedAt", "levelOfSupervision", "visitType", "state"
where id in (1585945, 1589351)
order by id, "versionCreatedAt"

This seems to have been the case since 2018.

The visitType field what is used for billing and dashboard. The levelOfSupervision field does not contradict visitType:

-- demonstrating that levelOfSupervision does not contradict visitType
select "levelOfSupervision", "visitType", * 
from replica."VisitReports" where
state <> 'approved'
AND date > '2025-01-01'
AND coalesce("levelOfSupervision", "visitType") <> "visitType"
LIMIT 500;

Some options:

  1. Document the levelOfSupervision field should not be used
  2. Drop the levelOfSupervision field
  3. Fuller fix - straighten out the difference between supervision level (unsupervised, monitored, supervised), transport needs (yes or no) and whether it's a parent or sibling visit (also called visit type in some places)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions