Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-stender committed Oct 7, 2024
2 parents 7d4b067 + 7cbb935 commit 4f08493
Show file tree
Hide file tree
Showing 132 changed files with 136,825 additions and 62,013 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add schema mapper for the `REC/2024/06/plate-reader` schema.
- Checks for missing well item amplification and results data in quantstudio
- Add csv support to ThermoFisher Nanodrop One
- Add Thermo SkanIt adapter
- Made Agilent Gen5 adapter compatible with the new REC schema

### Fixed
Expand Down
10 changes: 6 additions & 4 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Everything else is jointly owned by senior parser developers and Benchling Connect team
* @slopez-b @alejandro-salgado @Benchling-Open-Source/benchling-connect
* @slopez-b @alejandro-salgado @Benchling-Open-Source/benchling-connect
# Limit allotrope schema code and CODEOWNERS to Benchling Connect team
src/allotropy/allotrope @Benchling-Open-Source/benchling-connect
CODEOWNERS @Benchling-Open-Source/benchling-connect
src/allotropy/allotrope @Benchling-Open-Source/benchling-connect
CODEOWNERS @Benchling-Open-Source/benchling-connect
# Give ASM experts ownership over docs (Benchling Connect as backup)
docs @james-leinas @Benchling-Open-Source/benchling-connect
docs @james-leinas @Benchling-Open-Source/benchling-connect
src/allotropy/allotrope/schemas/schemas @james-leinas @Benchling-Open-Source/benchling-connect
src/allotropy/allotrope/schemas/models @james-leinas @Benchling-Open-Source/benchling-connect
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ We currently have parser support for the following instruments:
### Candidate Release

### Working Draft
- Thermo SkanIt
- Revvity Matrix

The parsers follow maturation levels of: Recommended, Candidate Release, Working Draft - see [release_state.py](https://github.com/Benchling-Open-Source/allotropy/blob/main/src/allotropy/parsers/release_state.py) for additional details.
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ and *must* define set `DISPLAY_NAME`, `RELEASE_STATE`, and `SCHEMA_MAPPER` and i
`create_data` that takes a `NamedFileContents` objects as input and produces an instance of (something derived from) `Data` as a result:

```python
class ExampleWeylandYutaniParser(MapperVendorParser[Data, Model]):
class ExampleWeylandYutaniParser(VendorParser[Data, Model]):
DISPLAY_NAME = DISPLAY_NAME
RELEASE_STATE = ReleaseState.WORKING_DRAFT
SCHEMA_MAPPER = Mapper
Expand Down
4 changes: 2 additions & 2 deletions scripts/templates/parser_template
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ from allotropy.parsers.$PARSER_NAME$.$PARSER_NAME$_structure import (
create_metadata,
)
from allotropy.parsers.utils.pandas import map_rows
from allotropy.parsers.vendor_parser import MapperVendorParser
from allotropy.parsers.vendor_parser import VendorParser


class $CLASS_NAME_PREFIX$Parser(MapperVendorParser[Data, Model]):
class $CLASS_NAME_PREFIX$Parser(VendorParser[Data, Model]):
DISPLAY_NAME = DISPLAY_NAME
RELEASE_STATE = ReleaseState.WORKING_DRAFT
SUPPORTED_EXTENSIONS = $CLASS_NAME_PREFIX$Reader.SUPPORTED_EXTENSIONS
Expand Down
28 changes: 21 additions & 7 deletions src/allotropy/allotrope/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,32 @@ def add_custom_information_document(
if not custom_info_doc:
return model

if isinstance(custom_info_doc, dict):
custom_info_doc = structure_custom_information_document(
custom_info_doc, "custom information document"
)
if not is_dataclass(custom_info_doc):
# Convert to a dictionary first, so we can clean up values.
if is_dataclass(custom_info_doc):
custom_info_dict = asdict(custom_info_doc)
elif isinstance(custom_info_doc, dict):
custom_info_dict = custom_info_doc
else:
msg = f"Invalid custom_info_doc: {custom_info_doc}"
raise ValueError(msg)

# Do not add custom info doc if all values are None
if all(value is None for value in asdict(custom_info_doc).values()):
# Remove None and {"value": None, "unit"...} values
cleaned_dict = {}
for key, value in custom_info_dict.items():
if value is None:
continue
if isinstance(value, dict) and "value" in value and value["value"] is None:
continue
cleaned_dict[key] = value

# If dict is empty after cleaning, do not attach.
if not cleaned_dict:
return model

custom_info_doc = structure_custom_information_document(
cleaned_dict, "custom information document"
)

model.custom_information_document = custom_info_doc # type: ignore
return model

Expand Down
Empty file.
Loading

0 comments on commit 4f08493

Please sign in to comment.