@@ -33,8 +33,18 @@ def _create_measurement(
3333 well_plate_identifier : str ,
3434 plate_data : dict [str , pd .DataFrame ],
3535 histograms : dict [str , tuple [list [float ], list [float ]]],
36+ header_data : dict [str , float | str | None ],
3637) -> Measurement :
3738 location_identifier = f"{ well_row } { well_col } "
39+ data_processing_document = {
40+ "Min. SpotSize" : header_data .pop ("Min. SpotSize" , None ),
41+ "Max. SpotSize" : header_data .pop ("Max. SpotSize" , None ),
42+ "Spot Separation" : header_data .pop ("Spot Separation" , None ),
43+ }
44+ has_data = any (
45+ value is not None and str (value ).strip () != ""
46+ for value in data_processing_document .values ()
47+ )
3848 return Measurement (
3949 type_ = MeasurementType .OPTICAL_IMAGING ,
4050 device_type = constants .DEVICE_TYPE ,
@@ -45,6 +55,7 @@ def _create_measurement(
4555 detection_type = constants .DETECTION_TYPE ,
4656 processed_data = ProcessedData (
4757 identifier = random_uuid_str (),
58+ data_processing_document = data_processing_document if has_data else None ,
4859 features = [
4960 ImageFeature (
5061 identifier = random_uuid_str (),
@@ -77,6 +88,7 @@ def _create_measurement(
7788 ]
7889 if histograms and location_identifier in histograms
7990 else None ,
91+ device_control_custom_info = header_data ,
8092 )
8193
8294
@@ -94,16 +106,28 @@ def create_measurement_groups(
94106 round_to_nearest_well_count (first_plate .size ),
95107 f"Unable to determine valid plate count from dataframe of size: { first_plate .size } " ,
96108 )
109+ measurement_time = header [str , ("Counted" , "Review Date" )]
110+ analyst = header [str , "Authenticated user" ]
111+ custom_info = {
112+ "Assay" : header .get (str , "Assay" ),
113+ }
114+ header_data = header .get_unread ()
97115 return [
98116 MeasurementGroup (
99117 plate_well_count = plate_well_count ,
100- measurement_time = header [ str , ( "Counted" , "Review Date" )] ,
101- analyst = header [ str , "Authenticated user" ] ,
118+ measurement_time = measurement_time ,
119+ analyst = analyst ,
102120 measurements = [
103121 _create_measurement (
104- row , col , well_plate_identifier , plate_data , histograms
122+ row ,
123+ col ,
124+ well_plate_identifier ,
125+ plate_data ,
126+ histograms ,
127+ header_data .copy (),
105128 )
106129 ],
130+ custom_info = custom_info ,
107131 )
108132 for row in first_plate .index
109133 for col in first_plate .columns
0 commit comments