Esempio n. 1
0
def chemicalanalysis(request, chemical_analysis_id):


	chemanalysisobj =ChemicalAnalysisObject(chemical_analysis_id)
	if chemanalysisobj.exists():
		return render(request, 'chemicalanalysisview.html',{'chemicalanalysis':chemanalysisobj,}) 
	else:
		return HttpResponse("Chemical Analysis does not exist")
Esempio n. 2
0
def chemical_analysis(request, chemical_analysis_id):
    email = request.GET.get('email', None)
    api_key = request.GET.get('api_key', None)
    api = MetPet(email, api_key).api

    chem_analysis =ChemicalAnalysisObject(chemical_analysis_id)
    chem_analysis_obj = api.chemical_analysis.get(chemical_analysis_id).data

    subsample = api.subsample.get_by_uri(chem_analysis_obj['subsample']).data

    if chem_analysis:
        del chem_analysis.attributes['analysis_date']
        data = {
            'chemical_analysis': chem_analysis.attributes,
            'subsample_id': subsample['subsample_id'],
            'sample_id': subsample['sample'].split('/')[-2]
        }
        return HttpResponse(json.dumps(data), content_type='application/json')
    else:
        return HttpResponse("Chemical Analysis does not exist")
Esempio n. 3
0
def chemical_analysis(request, chemical_analysis_id):
    chemicalAnalysisObj = ChemicalAnalysisObject(chemical_analysis_id)
    return HttpResponse(chemicalAnalysisObj.json())