Skip to content

Commit

Permalink
CVA-244/variant interpretation logs (#39)
Browse files Browse the repository at this point in the history
* feat: add post variant interpretation logs feature

* chore: bump version
  • Loading branch information
andyb3 authored Apr 27, 2021
1 parent 19bcf47 commit 2b2e00b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
20 changes: 20 additions & 0 deletions pycipapi/cipapi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
CipApiOverview,
CipApiCase,
ClinicalReport,
VariantInterpretationLog,
Referral,
RequestStatus,
InterpretationFlag,
Expand Down Expand Up @@ -126,6 +127,14 @@ def submit_clinical_report_raw(self, payload, partner_id, analysis_type, report_
url = self.build_url(self.url_base, self.CR_ENDPOINT, partner_id, analysis_type, report_id) + '/'
return self.post(url, payload, params=params)

def submit_variant_interpretation_logs_raw(self, payload, case_id, case_version, **params):
case_id_version = "{ir_id}-{ir_version}".format(
ir_id=case_id,
ir_version=case_version
)
url = self.build_url(self.url_base, self.IR_ENDPOINT, case_id_version, 'variant-interpretation-log') + '/'
return self.post(url, payload, params=params)

def submit_interpretation_flags_raw(self, payload, case_id, case_version, **params):
url = self.build_url(self.url_base, self.IR_ENDPOINT, case_id, case_version, 'interpretation-flags') + '/'
return self.post(url, payload, params=params)
Expand Down Expand Up @@ -354,6 +363,17 @@ def submit_clinical_report(self, payload, partner_id, analysis_type, report_id,
"""
return self.submit_clinical_report_raw(payload, partner_id, analysis_type, report_id, **params)

@returns_item(VariantInterpretationLog, multi=False)
def submit_variant_interpretation_logs(self, vils, case_id, case_version, **params):
"""
:type vils: list
:type case_id: int
:type case_version: int
:rtype: VariantInterpretationLog
"""
payload = {"log_entry": vils}
return self.submit_variant_interpretation_logs_raw(payload, case_id, case_version, **params)

@returns_item(Referral, multi=True)
def list_referral(self, **params):
"""
Expand Down
6 changes: 6 additions & 0 deletions pycipapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ def __init__(self, **kwargs):
self.timestamp = kwargs.get('timestamp')


class VariantInterpretationLog(object):
def __init__(self, **kwargs):
self.case_updated = kwargs.get('case_updated')
self.log_entry = kwargs.get('log_entry').get('log_entry')


class ExitQuestionnaire(object):
def __init__(self, **kwargs):
self.created_at = kwargs.get('created_at')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pycipapi',
version='0.10.2',
version='0.11.0',
packages=find_packages(),
scripts=[],
url='https://github.com/genomicsengland/pycipapi',
Expand Down

0 comments on commit 2b2e00b

Please sign in to comment.