Skip to content

Commit bbf8660

Browse files
Add tables and fields required for processed data'
1 parent e08d2bc commit bbf8660

File tree

2 files changed

+292
-13
lines changed

2 files changed

+292
-13
lines changed

models/build.rs

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,85 @@ struct Table<'a> {
1515
columns: &'a [&'a str],
1616
}
1717

18-
const TABLES_SPECS: &[&Table] = &[&Table {
19-
name: "DataCollectionFileAttachment",
20-
columns: &[
21-
"dataCollectionFileAttachmentId",
22-
"dataCollectionId",
23-
"fileFullPath",
24-
],
25-
}];
18+
const TABLES_SPECS: &[&Table] = &[
19+
&Table {
20+
name: "DataCollectionFileAttachment",
21+
columns: &[
22+
"dataCollectionFileAttachmentId",
23+
"dataCollectionId",
24+
"fileFullPath",
25+
],
26+
},
27+
&Table {
28+
name: "ProcessingJob",
29+
columns: &[
30+
"processingJobId",
31+
"dataCollectionId",
32+
"displayName",
33+
"automatic",
34+
],
35+
},
36+
&Table {
37+
name: "AutoProc",
38+
columns: &[
39+
"autoProcId",
40+
"autoProcProgramId",
41+
"spaceGroup",
42+
"refinedCell_a",
43+
"refinedCell_b",
44+
"refinedCell_c",
45+
"refinedCell_alpha",
46+
"refinedCell_beta",
47+
"refinedCell_gamma",
48+
],
49+
},
50+
&Table {
51+
name: "AutoProcProgram",
52+
columns: &[
53+
"autoProcProgramId",
54+
"processingPrograms",
55+
"processingStatus",
56+
"processingMessage",
57+
"processingJobId",
58+
],
59+
},
60+
&Table {
61+
name: "AutoProcIntegration",
62+
columns: &[
63+
"autoProcIntegrationId",
64+
"dataCollectionId",
65+
"autoProcProgramId",
66+
"refinedXBeam",
67+
"refinedYBeam",
68+
],
69+
},
70+
&Table {
71+
name: "AutoProcScaling",
72+
columns: &["autoProcScalingId", "autoProcId"],
73+
},
74+
&Table {
75+
name: "AutoProcScalingStatistics",
76+
columns: &[
77+
"autoProcScalingStatisticsId",
78+
"autoProcScalingId",
79+
"ccHalf",
80+
"ccAnomalous",
81+
"nTotalObservations",
82+
"nTotalUniqueObservations",
83+
"resolutionLimitLow",
84+
"resolutionLimitHigh",
85+
"scalingStatisticsType",
86+
"rMeasAllIPlusIMinus",
87+
"anomalousCompleteness",
88+
"anomalousMultiplicity",
89+
"rMerge",
90+
"completeness",
91+
"multiplicity",
92+
"meanIOverSigI",
93+
"resioversigi2",
94+
],
95+
},
96+
];
2697

2798
fn main() {
2899
tokio::runtime::Builder::new_current_thread()

processed_data/src/graphql/entities.rs

Lines changed: 213 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
use async_graphql::SimpleObject;
2-
use models::data_collection_file_attachment;
1+
use async_graphql::{Enum, SimpleObject};
2+
use models::{
3+
auto_proc, auto_proc_integration, auto_proc_program, auto_proc_scaling,
4+
auto_proc_scaling_statistics, data_collection_file_attachment, processing_job,
5+
sea_orm_active_enums::ScalingStatisticsType,
6+
};
37

48
/// Represents processed image file stored in s3 bucket
59
#[derive(Clone, Debug, PartialEq, SimpleObject)]
@@ -13,10 +17,214 @@ pub struct DataProcessing {
1317
}
1418

1519
impl From<data_collection_file_attachment::Model> for DataProcessing {
16-
fn from(values: data_collection_file_attachment::Model) -> Self {
20+
fn from(value: data_collection_file_attachment::Model) -> Self {
1721
Self {
18-
id: values.data_collection_file_attachment_id,
19-
file_full_path: values.file_full_path,
22+
id: value.data_collection_file_attachment_id,
23+
file_full_path: value.file_full_path,
24+
}
25+
}
26+
}
27+
28+
/// Represents a processing job
29+
#[derive(Clone, Debug, PartialEq, SimpleObject)]
30+
#[graphql(name = "ProcessingJob", unresolvable)]
31+
pub struct ProcessingJob {
32+
/// An opaque unique identifier for the processing job
33+
pub processing_job_id: u32,
34+
/// An opaque unique identifier for the data collection
35+
pub data_collection_id: Option<u32>,
36+
/// Processing job display name
37+
pub display_name: Option<String>,
38+
/// Represents if the job is automatic or downstream
39+
pub automatic: Option<i8>,
40+
}
41+
42+
impl From<processing_job::Model> for ProcessingJob {
43+
fn from(value: processing_job::Model) -> Self {
44+
Self {
45+
processing_job_id: value.processing_job_id,
46+
data_collection_id: value.data_collection_id,
47+
display_name: value.display_name,
48+
automatic: value.automatic,
49+
}
50+
}
51+
}
52+
53+
/// Represents an auto processed job
54+
#[derive(Clone, Debug, PartialEq, SimpleObject)]
55+
#[graphql(name = "AutoProc", unresolvable)]
56+
pub struct AutoProc {
57+
/// An opaque unique identifier for the auto processing
58+
pub auto_proc_id: u32,
59+
/// An opaque unique identifier for the auto processing program
60+
pub auto_proc_program_id: Option<u32>,
61+
/// Space group of the processing job
62+
pub space_group: Option<String>,
63+
/// Refined cell a in the auto processing job
64+
pub refined_cell_a: Option<f32>,
65+
/// Refined cell b in the auto processing job
66+
pub refined_cell_b: Option<f32>,
67+
/// Refined cell c in the auto processing job
68+
pub refined_cell_c: Option<f32>,
69+
/// Refined cell alpha in the auto processing job
70+
pub refined_cell_alpha: Option<f32>,
71+
/// Refined cell beta in the auto processing job
72+
pub refined_cell_beta: Option<f32>,
73+
/// Refined cell gamma in the auto processing job
74+
pub refined_cell_gamma: Option<f32>,
75+
}
76+
77+
impl From<auto_proc::Model> for AutoProc {
78+
fn from(value: auto_proc::Model) -> Self {
79+
Self {
80+
auto_proc_id: value.auto_proc_id,
81+
auto_proc_program_id: value.auto_proc_program_id,
82+
space_group: value.space_group,
83+
refined_cell_a: value.refined_cell_a,
84+
refined_cell_b: value.refined_cell_b,
85+
refined_cell_c: value.refined_cell_c,
86+
refined_cell_alpha: value.refined_cell_alpha,
87+
refined_cell_beta: value.refined_cell_beta,
88+
refined_cell_gamma: value.refined_cell_gamma,
89+
}
90+
}
91+
}
92+
93+
/// Represents an auto processed program
94+
#[derive(Clone, Debug, PartialEq, SimpleObject)]
95+
#[graphql(name = "AutoProcProgram", unresolvable)]
96+
pub struct AutoProcProgram {
97+
/// An opaque unique identifier for the auto processing program
98+
pub auto_proc_program_id: u32,
99+
/// Name of the processing programs
100+
pub processing_programs: Option<String>,
101+
/// Processing program status
102+
pub processing_status: Option<i8>,
103+
/// Processing program message
104+
pub processing_message: Option<String>,
105+
/// An opaque unique identifier for the processing processing job
106+
pub processing_job_id: Option<u32>,
107+
}
108+
109+
impl From<auto_proc_program::Model> for AutoProcProgram {
110+
fn from(value: auto_proc_program::Model) -> Self {
111+
Self {
112+
auto_proc_program_id: value.auto_proc_program_id,
113+
processing_programs: value.processing_programs,
114+
processing_status: value.processing_status,
115+
processing_message: value.processing_message,
116+
processing_job_id: value.processing_job_id,
117+
}
118+
}
119+
}
120+
121+
/// Represents an auto processing integration
122+
#[derive(Clone, Debug, PartialEq, SimpleObject)]
123+
#[graphql(name = "AutoProcIntegration", unresolvable)]
124+
pub struct AutoProcIntegration {
125+
/// An opaque unique identifier for the auto processing integration
126+
pub auto_proc_integration_id: u32,
127+
/// An opaque unique identifier for the data collection
128+
pub data_collection_id: u32,
129+
/// An opaque unique identifier for the auto processing program
130+
pub auto_proc_program_id: Option<u32>,
131+
/// Refined X position of the beam
132+
pub refined_x_beam: Option<f32>,
133+
/// Refined Y position of the beam
134+
pub refined_y_beam: Option<f32>,
135+
}
136+
137+
impl From<auto_proc_integration::Model> for AutoProcIntegration {
138+
fn from(value: auto_proc_integration::Model) -> Self {
139+
Self {
140+
auto_proc_integration_id: value.auto_proc_integration_id,
141+
data_collection_id: value.data_collection_id,
142+
auto_proc_program_id: value.auto_proc_program_id,
143+
refined_x_beam: value.refined_x_beam,
144+
refined_y_beam: value.refined_y_beam,
145+
}
146+
}
147+
}
148+
149+
/// Represents and auto processing scaling
150+
#[derive(Clone, Debug, PartialEq, SimpleObject)]
151+
#[graphql(name = "AutoProcScaling", unresolvable)]
152+
pub struct AutoProcScaling {
153+
/// An opaque unique identifier for the auto processing scaling
154+
pub auto_proc_scaling_id: u32,
155+
/// An opaque unique identifier for the auto processing
156+
pub auto_proc_id: Option<u32>,
157+
}
158+
159+
impl From<auto_proc_scaling::Model> for AutoProcScaling {
160+
fn from(value: auto_proc_scaling::Model) -> Self {
161+
Self {
162+
auto_proc_scaling_id: value.auto_proc_scaling_id,
163+
auto_proc_id: value.auto_proc_id,
164+
}
165+
}
166+
}
167+
168+
#[derive(Enum, Copy, Clone, Debug, PartialEq, Eq)]
169+
#[allow(clippy::missing_docs_in_private_items)]
170+
pub enum StatisticsType {
171+
Overall,
172+
InnerShell,
173+
OuterShell,
174+
}
175+
176+
/// Represents auto processing scaling statics
177+
#[derive(Clone, Debug, PartialEq, SimpleObject)]
178+
#[graphql(name = "AutoProcScalingStatics", unresolvable)]
179+
#[allow(clippy::missing_docs_in_private_items)]
180+
pub struct AutoProcScalingStatics {
181+
pub auto_proc_scaling_statistics_id: u32,
182+
pub auto_proc_scaling_id: Option<u32>,
183+
pub scaling_statistics_type: StatisticsType,
184+
pub resolution_limit_low: Option<f32>,
185+
pub resolution_limit_high: Option<f32>,
186+
pub r_merge: Option<f32>,
187+
pub r_meas_all_i_plus_i_minus: Option<f32>,
188+
pub n_total_observations: Option<i32>,
189+
pub n_total_unique_observations: Option<i32>,
190+
pub mean_i_over_sig_i: Option<f32>,
191+
pub completeness: Option<f32>,
192+
pub multiplicity: Option<f32>,
193+
pub anomalous_completeness: Option<f32>,
194+
pub anomalous_multiplicity: Option<f32>,
195+
pub cc_half: Option<f32>,
196+
pub cc_anomalous: Option<f32>,
197+
}
198+
199+
impl From<ScalingStatisticsType> for StatisticsType {
200+
fn from(value: ScalingStatisticsType) -> Self {
201+
match value {
202+
ScalingStatisticsType::Overall => StatisticsType::Overall,
203+
ScalingStatisticsType::InnerShell => StatisticsType::InnerShell,
204+
ScalingStatisticsType::OuterShell => StatisticsType::OuterShell,
205+
}
206+
}
207+
}
208+
209+
impl From<auto_proc_scaling_statistics::Model> for AutoProcScalingStatics {
210+
fn from(value: auto_proc_scaling_statistics::Model) -> Self {
211+
Self {
212+
auto_proc_scaling_id: value.auto_proc_scaling_id,
213+
auto_proc_scaling_statistics_id: value.auto_proc_scaling_statistics_id,
214+
resolution_limit_low: value.resolution_limit_low,
215+
resolution_limit_high: value.resolution_limit_high,
216+
r_merge: value.r_merge,
217+
r_meas_all_i_plus_i_minus: value.r_meas_all_i_plus_i_minus,
218+
n_total_observations: value.n_total_observations,
219+
n_total_unique_observations: value.n_total_unique_observations,
220+
mean_i_over_sig_i: value.mean_i_over_sig_i,
221+
completeness: value.completeness,
222+
multiplicity: value.multiplicity,
223+
anomalous_completeness: value.anomalous_completeness,
224+
anomalous_multiplicity: value.anomalous_multiplicity,
225+
cc_half: value.cc_half,
226+
cc_anomalous: value.cc_anomalous,
227+
scaling_statistics_type: StatisticsType::from(value.scaling_statistics_type),
20228
}
21229
}
22230
}

0 commit comments

Comments
 (0)