Skip to content

Commit

Permalink
Aliquot
Browse files Browse the repository at this point in the history
  • Loading branch information
KeironO committed Jan 19, 2021
1 parent 47e57c6 commit f5d8d49
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions services/web/app/sample/api/aliquot.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def _validate_aliquots(aliquots: list) -> bool:
valid = True
if len(aliquots) == 0:
return False

for aliquot in aliquots:
for key in ["container", "volume", "barcode"]:
try:
Expand All @@ -79,7 +80,6 @@ def _validate_aliquots(aliquots: list) -> bool:
return valid

values = request.get_json()
print('values: ', values)

if not values:
return no_values_response()
Expand Down Expand Up @@ -130,15 +130,13 @@ def _validate_aliquots(aliquots: list) -> bool:
except ValidationError as err:
return validation_error_response(err)


# TODO: Use existing API endpoint.
# T1: new protocol event for parent sample
new_event = SampleProtocolEvent(**event_result)
new_event.is_locked = True # ??to indicate events involving new sample creation
db.session.add(new_event)
db.session.flush()
print('new_event id: ', new_event.id)

print('base_type: ', base_type)
print('type_values: ', type_values)
for aliquot in values["aliquots"]:
# T2. New sampletotypes for subsamples: store data on sample type and container
ali_sampletotype = SampleToType(**type_values)
Expand All @@ -161,7 +159,7 @@ def _validate_aliquots(aliquots: list) -> bool:
except Exception as err:
return transaction_error_response(err)

# T3. New subsuamples
# T3. New subsamples
ali_sample = Sample(**sample_values)

ali_sample.id = None
Expand All @@ -175,7 +173,6 @@ def _validate_aliquots(aliquots: list) -> bool:

db.session.add(ali_sample)
db.session.flush()
print('ali_sample.id: ', ali_sample.id)

# T4. New subsampletosample
ssts = SubSampleToSample(
Expand Down

0 comments on commit f5d8d49

Please sign in to comment.