Skip to content

Gate calibration publishing on PHI acknowledgment when controls are present #752

@bencap

Description

@bencap

Summary

Extend the publish_score_calibration logic so that a calibration with controls cannot be published unless controls_not_phi is True.

Background

Control variant data (variant + clinical status) must not be PHI. The submitter is required to affirm this before the data becomes public. controls_not_phi is stored on ScoreCalibration and must equal True for any calibration with controls to leave the private state.

Proposed Behavior

In lib/score_calibrations.pypublish_score_calibration:

  • If the calibration has one or more controls AND controls_not_phi is not True, raise an HTTP 422 with a message explaining that the PHI acknowledgment is required before the calibration can be published
  • This gate must not block calibrations with zero controls (PHI acknowledgment is only relevant when controls are present)

Acceptance Criteria

  • Attempting to publish a calibration with controls and controls_not_phi != True returns a 422 with a descriptive message
  • Publishing a calibration with controls and controls_not_phi = True succeeds (all else valid)
  • Publishing a calibration with zero controls is unaffected regardless of controls_not_phi value
  • Existing publish tests pass; new tests cover the gate behavior

Implementation Notes

  • The check belongs in the existing publish_score_calibration function in lib/score_calibrations.py
  • controls_not_phi being None (not yet addressed) should be treated as not acknowledged — only True passes the gate
  • This gate applies to the transition from private → public only; it does not retroactively unpublish calibrations

Additional Consideration: Re-acknowledgment on Controls Change

If a submitter publishes a calibration (setting controls_not_phi = True), then subsequently replaces the controls list via an update, the original acknowledgment now covers different data than what was affirmed. Consider whether controls_not_phi should be reset to null automatically whenever the controls list is replaced. This behavior should be consistent between the inline JSON and CSV upload paths.

Suggested behavior: when a modify operation includes a non-null/non-empty controls update (i.e., controls are being changed), reset controls_not_phi to null so the submitter must re-acknowledge before republishing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions