Open davmlaw opened 3 years ago
Talked to James and API keys is probably the way to go, have a quick read of some docs about this:
https://www.django-rest-framework.org/api-guide/authentication/
~working in branch "seqauto_api"~ - pushed phase 1 to master as I may have to do other stuff for a while
Plan for step 1 - build API:
Plan for step 2 and 3 - write client code
The client calling code and libraries to load objects will be kept in SA Path repo
OK been working out how to best do things:
seqauto/test_data/api_client
as "json" filesCan use SlugRelatedField to lookup via natural keys
SampleGeneList needs a sample, and VCF may not be loaded by the time we load the QC Gene list. We just try QCGeneList.create_and_assign_sample_gene_list then handle the SampleFromSequencingSample.DoesNotExist and carry on if VCF not loaded yet
Then in VCF import we run: upload.vcf.vcf_import.link_samples_and_vcfs_to_sequencing which attempts it again
This should probably be a signal that we handle in seqauto app but can do that later
For the API - we'll just make ActiveSampleGeneList
the latest one
TODO:
VariantGrid Sequencing API
Goal: TAU diagnostic team make API calls to upload VCFs and other sequencing related data to VariantGrid at the end of their pipelines
Current behavior: VariantGrid runs scheduled (and manually triggered) scans that use “find” to scan the TAU disks for sequencing files and loading them into the system
Motivating problems w/current:
“Find” causes high server/network/disk usage Lag between pipeline finishing and VG finding new files (requires manual button press or waiting for next scheduled scan) VG needs to have filesystem access (cloud systems have no sequencing file automation) VG developers need to know TAU details (eg paths to different VCF files used by different kits/panels) and update code
—--------
Plan:
[1] An idempotent API is one where the operation will have the same result no matter how many times it's applied. This is so we can leave the scanning on, and have pipelines run multiple times, without having to write special purpose client side code (eg to handle errors if sequencing run already added by auto scan or previous pipeline runs)
[2] API example:
We already have PyPI - https://pypi.org/project/variantgrid_api/0.2.0/
The only thing that uses this is Maptastic which is an obsolete version of omni-importer
We have an old repo: https://github.com/SACGF/vg_api Created new repo: https://github.com/SACGF/variantgrid_api
The PyPI variantgrid_api should be minimalistic - the details of loading SA Path stuff will be done in other code and put in SA Path repo