airtable
upsert_image #
upsert_image(at_api, ds_name, image_name, image_path, image_title, image_type, institution='HHMI / Janelia Research Campus', challenge=False)
Upsert a record to airtable image table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_table |
Table
|
image airtable object to create references. |
required |
ds_name |
str
|
name of the dataset. |
required |
image_name |
str
|
name of the image to upsert. |
required |
image_path |
str
|
image location. |
required |
image_title |
str
|
image title on openorganelle.com. |
required |
image_type |
Literal['human_segmentation', 'em']
|
image type |
required |
collection_table |
Table
|
collation airtable object to create references. |
required |
fibsem_table |
Table
|
fibsem_imaging airtable object to create references. |
required |
annotation_table |
Table
|
annotation airtable object to create references. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
raise value error if multiple records with the same location and name are found in the image table. |
Source code in src/cellmap_utils/airtable/upsert/image.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
upsert_record_scene_tables #
upsert_record_scene_tables(scene_table, scene_to_image_table, image_table, image_location, scene_data={}, scene_to_image_data={})
This method upserts records into scene and scene_to_image table at the same time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scene_table |
Table
|
output table to upsert |
required |
scene_to_image_table |
Table
|
output table to upsert |
required |
image_table |
Table
|
input table from where the record is being taken |
required |
image_location |
str
|
provides value for location filter paramater for the image record |
required |
scene_update |
dict
|
custom data to upsert into "scene" table |
required |
scene_to_image_update |
dict
|
custom data to upsert in "scene_to_image" table |
required |
Returns:
Type | Description |
---|---|
Tuple[dict]
|
Tuple[dict]: output records that were upserted |
Source code in src/cellmap_utils/airtable/upsert/scene.py
get_image_record #
Read an image record from airtable and return supabase image, dataset, sample, and acquisition records.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_path |
str
|
path to dataset used as a filter parameter for airtable image table records |
required |
at_api |
api
|
airtable api instance |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
returns a dictionary of records, with pydantic models for supabase table records as values. |
Source code in src/cellmap_utils/airtable/supabase/air_to_supabase.py
filter_records #
Custom method to filter records by a field value. all(formula=match({})) doesn't work when filtering by reference.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
records |
dict)
|
list of all records in a table. Not using table.all() within a method, since it slow to fetch all the records every time when a method is called. |
required |
field |
str
|
table field name |
required |
field_value |
list[str] | str
|
table field value |
required |
Returns:
Type | Description |
---|---|
list[dict]: return records with filter_value for filter_field field |