-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat (MM): State Change Event (#569)
- Loading branch information
1 parent
29a9949
commit 61e50e6
Showing
25 changed files
with
1,014 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test: | ||
@check-jsonschema --schemafile MetadataStateChange.schema.json example/MSC__example1.json | ||
@check-jsonschema --schemafile MetadataStateChange.schema.json example/MSC__example2.json |
78 changes: 78 additions & 0 deletions
78
docs/schemas/events/metadatamanager/MetadataStateChange.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$id": "https://raw.githubusercontent.com/umccr/orcabus/main/docs/schemas/events/metadatamanager/MetadataStateChange.schema.json", | ||
"description": "EventBridge custom event schema for orcabus.metadatamanager@MetadataStateChange", | ||
"title": "AWSEvent", | ||
"type": "object", | ||
"required": [ | ||
"detail-type", | ||
"detail", | ||
"source" | ||
], | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"region": { | ||
"type": "string" | ||
}, | ||
"resources": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"source": { | ||
"enum": ["orcabus.metadatamanager"] | ||
}, | ||
"time": { | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"version": { | ||
"type": "string" | ||
}, | ||
"account": { | ||
"type": "string" | ||
}, | ||
"detail-type": { | ||
"enum": ["MetadataStateChange"] | ||
}, | ||
"detail": { | ||
"$ref": "#/definitions/MetadataStateChange" | ||
} | ||
}, | ||
"definitions": { | ||
"MetadataStateChange": { | ||
"type": "object", | ||
"required": [ | ||
"model", | ||
"action", | ||
"data", | ||
"refId" | ||
], | ||
"properties": { | ||
"model": { | ||
"type": "string", | ||
"enum": [ | ||
"LIBRARY" | ||
] | ||
}, | ||
"action": { | ||
"type": "string", | ||
"enum": [ | ||
"CREATE", | ||
"UPDATE", | ||
"DELETE" | ||
] | ||
}, | ||
"refId": { | ||
"type": "string" | ||
}, | ||
"data": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
docs/schemas/events/metadatamanager/example/MSC__example1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"version": "0", | ||
"id": "f71bbbbb-5b36-40c2-f7dc-804ca6270cd6", | ||
"detail-type": "MetadataStateChange", | ||
"source": "orcabus.metadatamanager", | ||
"account": "123456789012", | ||
"time": "2024-05-01T09:25:44Z", | ||
"region": "ap-southeast-2", | ||
"resources": [], | ||
"detail": { | ||
"action": "CREATE", | ||
"model": "LIBRARY", | ||
"refId": "lib.01J8GMF3XCHW9CV8ZFS8F1P1RF", | ||
"data": { | ||
"orcabusId": "lib.01J8GMF3XCHW9CV8ZFS8F1P1RF", | ||
"libraryId": "L10001", | ||
"phenotype": "normal", | ||
"workflow": "research", | ||
"quality": "good", | ||
"type": "WTS", | ||
"assay": "ctTSO", | ||
"coverage": 120.0, | ||
"sample": "smp.01J8GMF3WD6TD5Y491EEBARYBE", | ||
"subject": "sbj.01J8GMF3VZRGYQG1GYDJC6E9MV" | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
docs/schemas/events/metadatamanager/example/MSC__example2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"version": "0", | ||
"id": "f71bbbbb-5b36-40c2-f7dc-804ca6270cd6", | ||
"detail-type": "MetadataStateChange", | ||
"source": "orcabus.metadatamanager", | ||
"account": "123456789012", | ||
"time": "2024-05-01T09:25:44Z", | ||
"region": "ap-southeast-2", | ||
"resources": [], | ||
"detail": { | ||
"action": "DELETE", | ||
"model": "LIBRARY", | ||
"refId": "lib.01J8GNBB7YK8RCVFGXSBV4ZKST", | ||
"data": { | ||
"orcabusId": "lib.01J8GNBB7YK8RCVFGXSBV4ZKST", | ||
"libraryId": "L10001", | ||
"phenotype": "normal", | ||
"workflow": "research", | ||
"quality": "poor", | ||
"type": "WTS", | ||
"assay": "ctTSO", | ||
"coverage": 120.0, | ||
"sample": "smp.01J8GNBB67HGG3G17QA5QP98TE", | ||
"subject": "sbj.01J8GNBB59GR0KMTNR0BT3F31V" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
lib/workload/stateless/stacks/metadata-manager/app/serializers/utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
|
||
def to_camel_case_key_dict(data: dict) -> dict: | ||
""" | ||
Convert dictionary keys from snake_case to camelCase. | ||
""" | ||
def snake_to_camel(word): | ||
components = word.split('_') | ||
# We capitalize the first letter of each component except the first one | ||
# with the 'title' method and join them together. | ||
return components[0] + ''.join(x.title() for x in components[1:]) | ||
|
||
new_data = {} | ||
for key, value in data.items(): | ||
new_key = snake_to_camel(key) | ||
new_data[new_key] = value | ||
return new_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.