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

remove old workflow state fields #1459

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 0 additions & 146 deletions modules/schema/src/main/resources/lucuma/odb/graphql/OdbSchema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3183,16 +3183,6 @@ input ObservationPropertiesInput {
"""
subtitle: NonEmptyString

"""
The observation status will default to New if not specified when an observation is created and may be edited but not deleted
"""
status: ObsStatus

"""
The observation active status will default to Active if not specified when an observation is created and may be edited but not deleted
"""
activeStatus: ObsActiveStatus

"""
The science band to assign to this observation. Set to `null` to remove the
science band.
Expand Down Expand Up @@ -3253,11 +3243,6 @@ input ObservationPropertiesInput {
Set the notes for thhe observer
"""
observerNotes: NonEmptyString

"""
Sets the "for review" bit.
"""
forReview: Boolean

}

Expand Down Expand Up @@ -8496,16 +8481,6 @@ type Observation {
"""
subtitle: NonEmptyString

"""
Observation status
"""
status: ObsStatus! @deprecated

"""
Observation operational status
"""
activeStatus: ObsActiveStatus! @deprecated

"""
Observations are associated with a science band once time has been allocated
to a program.
Expand Down Expand Up @@ -8583,11 +8558,6 @@ type Observation {
"""
itc: Itc!

"""
A list of observation validation problems
"""
validations: [ObservationValidation!]! @deprecated

"""
Enclosing group, if any.
"""
Expand Down Expand Up @@ -8618,12 +8588,6 @@ type Observation {
"""
configurationRequests: [ConfigurationRequest!]!

"""
This flag is set to true prior to Phase II, and must be reset to false by the PI prior to observation. The
intent is to prompt PIs to review their accepted observations.
"""
forReview: Boolean! @deprecated


workflow: ObservationWorkflow!

Expand Down Expand Up @@ -12553,26 +12517,11 @@ input WhereObservation {
"""
subtitle: WhereOptionString

"""
Matches the observation status.
"""
status: WhereOrderObsStatus

"""
Matches the observation active status.
"""
activeStatus: WhereOrderObsActiveStatus

"""
Matches the observation science band.
"""
scienceBand: WhereOptionOrderScienceBand

"""
Matches the "for review" bit.
"""
forReview: WhereBoolean

}

"""
Expand Down Expand Up @@ -13398,101 +13347,6 @@ input WhereOrderLong {
LTE: Long
}

"""
Filters on equality or order comparisons of the property. All supplied
criteria must match, but usually only one is selected. E.g., 'GT = 2'
for an integer property will match when the value is 3 or more.
"""
input WhereOrderObsActiveStatus {
"""
Matches if the property is exactly the supplied value.
"""
EQ: ObsActiveStatus

"""
Matches if the property is not the supplied value.
"""
NEQ: ObsActiveStatus

"""
Matches if the property value is any of the supplied options.
"""
IN: [ObsActiveStatus!]

"""
Matches if the property value is none of the supplied values.
"""
NIN: [ObsActiveStatus!]

"""
Matches if the property is ordered after (>) the supplied value.
"""
GT: ObsActiveStatus

"""
Matches if the property is ordered before (<) the supplied value.
"""
LT: ObsActiveStatus

"""
Matches if the property is ordered after or equal (>=) the supplied value.
"""
GTE: ObsActiveStatus

"""
Matches if the property is ordered before or equal (<=) the supplied value.
"""
LTE: ObsActiveStatus
}

"""
Filters on equality or order comparisons of the property. All supplied
criteria must match, but usually only one is selected. E.g., 'GT = 2'
for an integer property will match when the value is 3 or more.

"""
input WhereOrderObsStatus {
"""
Matches if the property is exactly the supplied value.
"""
EQ: ObsStatus

"""
Matches if the property is not the supplied value.
"""
NEQ: ObsStatus

"""
Matches if the property value is any of the supplied options.
"""
IN: [ObsStatus!]

"""
Matches if the property value is none of the supplied values.
"""
NIN: [ObsStatus!]

"""
Matches if the property is ordered after (>) the supplied value.
"""
GT: ObsStatus

"""
Matches if the property is ordered before (<) the supplied value.
"""
LT: ObsStatus

"""
Matches if the property is ordered after or equal (>=) the supplied value.
"""
GTE: ObsStatus

"""
Matches if the property is ordered before or equal (<=) the supplied value.
"""
LTE: ObsStatus
}

"""
Filters on equality or order comparisons of the property. All supplied
criteria must match, but usually only one is selected. E.g., 'GT = 2'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

-- Remove the observation view so we can drop underlying columns.
DROP VIEW v_observation;

-- Remove state bits that are no longer in use; add workflow state column.
ALTER TABLE t_observation
DROP c_status,
DROP c_active_status,
DROP c_for_review;

-- Re-create v_observation
CREATE OR REPLACE VIEW v_observation AS
SELECT o.*,
CASE WHEN c_explicit_ra IS NOT NULL THEN c_observation_id END AS c_explicit_base_id,
CASE WHEN c_air_mass_min IS NOT NULL THEN c_observation_id END AS c_air_mass_id,
CASE WHEN c_hour_angle_min IS NOT NULL THEN c_observation_id END AS c_hour_angle_id,
CASE WHEN c_observing_mode_type IS NOT NULL THEN c_observation_id END AS c_observing_mode_id,
CASE WHEN c_spec_wavelength IS NOT NULL THEN c_observation_id END AS c_spec_wavelength_id,
CASE WHEN c_spec_signal_to_noise_at IS NOT NULL THEN c_observation_id END AS c_spec_signal_to_noise_at_id,
CASE WHEN c_spec_wavelength_coverage IS NOT NULL THEN c_observation_id END AS c_spec_wavelength_coverage_id,
CASE WHEN c_spec_focal_plane_angle IS NOT NULL THEN c_observation_id END AS c_spec_focal_plane_angle_id,
CASE WHEN c_observation_duration IS NOT NULL THEN c_observation_id END AS c_observation_duration_id,
c.c_active_start::timestamp + (c.c_active_end::timestamp - c.c_active_start::timestamp) * 0.5 AS c_reference_time
FROM t_observation o
LEFT JOIN t_proposal p on p.c_program_id = o.c_program_id
LEFT JOIN t_cfp c on p.c_cfp_id = c.c_cfp_id
;

Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ trait BaseMapping[F[_]]
lazy val OffsetPType = schema.ref("OffsetP")
lazy val OffsetQType = schema.ref("OffsetQ")
lazy val OffsetType = schema.ref("Offset")
lazy val ObsActiveStatusType = schema.ref("ObsActiveStatus")
lazy val ObsAttachmentFileExtType = schema.ref("ObsAttachmentFileExt")
lazy val ObsAttachmentIdType = schema.ref("ObsAttachmentId")
lazy val ObsAttachmentType = schema.ref("ObsAttachment")
Expand All @@ -205,7 +204,6 @@ trait BaseMapping[F[_]]
lazy val ObservationReferenceLabelType = schema.ref("ObservationReferenceLabel")
lazy val ObservationSelectResultType = schema.ref("ObservationSelectResult")
lazy val ObserveClassType = schema.ref("ObserveClass")
lazy val ObsStatusType = schema.ref("ObsStatus")
lazy val ParallaxType = schema.ref("Parallax")
lazy val PartnerMetaType = schema.ref("PartnerMeta")
lazy val PartnerSplitType = schema.ref("PartnerSplit")
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import cats.syntax.all.*
import eu.timepit.refined.types.numeric.NonNegShort
import eu.timepit.refined.types.string.NonEmptyString
import grackle.Result
import lucuma.core.enums.ObsActiveStatus
import lucuma.core.enums.ObsStatus
import lucuma.core.enums.ScienceBand
import lucuma.core.model.Group
import lucuma.core.model.ObsAttachment
Expand All @@ -38,8 +36,6 @@ object ObservationPropertiesInput {

final case class Create(
subtitle: Option[NonEmptyString],
status: Option[ObsStatus],
activeStatus: Option[ObsActiveStatus],
scienceBand: Option[ScienceBand],
posAngleConstraint: Option[PosAngleConstraintInput],
targetEnvironment: Option[TargetEnvironmentInput.Create],
Expand All @@ -52,7 +48,6 @@ object ObservationPropertiesInput {
group: Option[Group.Id],
groupIndex: Option[NonNegShort],
observerNotes: Option[NonEmptyString],
forReview: Option[Boolean],
) extends AsterismInput

object Create {
Expand All @@ -63,8 +58,6 @@ object ObservationPropertiesInput {
val Default: Create =
Create(
subtitle = Option.empty,
status = ObsStatus.New.some,
activeStatus = ObsActiveStatus.Active.some,
scienceBand = None,
posAngleConstraint = None,
targetEnvironment = None,
Expand All @@ -77,15 +70,12 @@ object ObservationPropertiesInput {
group = None,
groupIndex = None,
observerNotes = None,
forReview = None,
)

val Binding: Matcher[Create] =
ObjectFieldsBinding.rmap {
case List(
NonEmptyStringBinding.Option("subtitle", rSubtitle),
ObsStatusBinding.Option("status", rObsStatus),
ObsActiveStatusBinding.Option("activeStatus", rObsActiveStatus),
ScienceBandBinding.Option("scienceBand", rScienceBand),
PosAngleConstraintInput.Binding.Option("posAngleConstraint", rPosAngleConstraint),
TargetEnvironmentInput.Create.Binding.Option("targetEnvironment", rTargetEnvironment),
Expand All @@ -98,11 +88,8 @@ object ObservationPropertiesInput {
GroupIdBinding.Option("groupId", rGroupId),
NonNegShortBinding.Option("groupIndex", rGroupIndex),
NonEmptyStringBinding.Option("observerNotes", rObserverNotes),
BooleanBinding.Option("forReview", rForReview)
) =>
(rSubtitle,
rObsStatus,
rObsActiveStatus,
rScienceBand,
rPosAngleConstraint,
rTargetEnvironment,
Expand All @@ -115,16 +102,13 @@ object ObservationPropertiesInput {
rGroupId,
rGroupIndex,
rObserverNotes,
rForReview,
).parMapN(Create.apply)
}

}

final case class Edit(
subtitle: Nullable[NonEmptyString],
status: Option[ObsStatus],
activeStatus: Option[ObsActiveStatus],
scienceBand: Nullable[ScienceBand],
posAngleConstraint: Option[PosAngleConstraintInput],
targetEnvironment: Option[TargetEnvironmentInput.Edit],
Expand All @@ -137,16 +121,13 @@ object ObservationPropertiesInput {
group: Nullable[Group.Id],
groupIndex: Option[NonNegShort],
observerNotes: Nullable[NonEmptyString],
forReview: Option[Boolean],
) extends AsterismInput

object Edit {

val Empty: Edit =
Edit(
subtitle = Nullable.Absent,
status = None,
activeStatus = None,
scienceBand = Nullable.Absent,
posAngleConstraint = None,
targetEnvironment = None,
Expand All @@ -159,15 +140,12 @@ object ObservationPropertiesInput {
group = Nullable.Absent,
groupIndex = None,
observerNotes = Nullable.Absent,
forReview = None,
)

val Binding: Matcher[Edit] =
ObjectFieldsBinding.rmap {
case List(
NonEmptyStringBinding.Nullable("subtitle", rSubtitle),
ObsStatusBinding.Option("status", rObsStatus),
ObsActiveStatusBinding.Option("activeStatus", rObsActiveStatus),
ScienceBandBinding.Nullable("scienceBand", rScienceBand),
PosAngleConstraintInput.Binding.Option("posAngleConstraint", rPosAngleConstraint),
TargetEnvironmentInput.Edit.Binding.Option("targetEnvironment", rTargetEnvironment),
Expand All @@ -180,11 +158,8 @@ object ObservationPropertiesInput {
GroupIdBinding.Nullable("groupId", rGroupId),
NonNegShortBinding.NonNullable("groupIndex", rGroupIndex),
NonEmptyStringBinding.Nullable("observerNotes", rObserverNotes),
BooleanBinding.Option("forReview", rForReview)
) =>
(rSubtitle,
rObsStatus,
rObsActiveStatus,
rScienceBand,
rPosAngleConstraint,
rTargetEnvironment,
Expand All @@ -197,7 +172,6 @@ object ObservationPropertiesInput {
rGroupId,
rGroupIndex,
rObserverNotes,
rForReview,
).parMapN(apply)
}
}
Expand Down
Loading
Loading