GithubHelp home page GithubHelp logo

fuzee's Introduction

Fuzee API

Interface to Fuzee API

Installation

install.packages("devtools")
devtools::install_github("ammaraziz/fuzee")

Usage

Hash your password

Generate a hash of your password. Type the following into your console:

 openssl::md5("mypassword")

Where mypassword is the password to log into fuzee. Output will look like:

% [1] "34819d7beeabb9260a5c854bc85b3e44"

Copy this hash, store it in a variable called password:

password = "34819d7beeabb9260a5c854bc85b3e44"

Do not store your password in plain text. Use the hashed string.

Download All Data

ExportAll

To download all data in a zip format, similar to the Export All button on Fuzee:

fuzee(username = '[email protected]', 
      password = password,
      file = 'Desktop/all.zip')

Where file is the directory/filename to save the zip file.

To uncompress the zip file in R, run the following:

unzip(zipfile = "location/to/zipfile",
	exdir = "location/to/extract",
	overwrite = TRUE)

Download individual datasets

Batches

First authenticate using auth then download the dataset with export_dataset:

cookie = auth(username = email, password = password)
samples = export_dataset(dataset = "Samples - Received", cookie = cookie)

export_datasets() returns a dataframe directly in R.

Note: The dataset option must match one of the following:

Samples - Storage
Batches 
BXA 
Despatch 
Egg Culture
GA-PCRID
GA-Pyro
GA-Sequencing
HI
NAI
Samples - Received
Samples - Storage 
Seqirus
Shipments 
VirusCulture 

Use get_codes() to see this list.

Future Improvments:

Support direct querying of:

  • Worksheets > Genetic Analysis > Show All
  • Shipments > Search Shipments
  • Shipments > Search Samples

fuzee's People

Contributors

ammaraziz avatar

Watchers

 avatar

fuzee's Issues

Add support for downloading reports

Provide functionality to download pdf reports sent via automated email.

Burger menu > History > Search Emails

Two step process, first send a POST to get a list emails per report followed by a GET request to download a specific report.

POST request

https://my.fuzee.com/ajax
cookies = FUZEESTAYLOGGEDIN=YES; FUZEEUSERAUTH=MXwxNjYxOTIxMTAxfG9IdjhwV29sZmdPbkMxa1Q%3D
request body = c=table&s=emailHistory&from=X&to=Y&type=

X/Y = date in YYYY-MM-DD format

POST Response:

A json with two fields.

  1. types contains a list of table names and their ID.
Object { table: "TABLEID", "ucase(left(`table`,1))": "Q", name: "Storage Listing" }

TABLEIDs need to be stored in a named list to access by name.

  1. data, which contains a list objects
type:  "Email"
id: "UNIQID"
table: "Report Name"
field: ""
data: "CentreName"
created: "25/08/2022 16:34"
user: "Person Name"
sort: "2022-08-25 16:34:16"
uid: ""
to: "email"

id is needed as the unique identifier to download the email.

GET request to download

https://my.fuzee.com/ajax?c=file&s=get&file_code=UNIQID

File is downloaded as an eml, which is plain text mime file. File needs to be read line by line until the attachment.

Attachment head:

--b1_946c9f3e62087e2f21e9b761e448c41851da4fefa86a7aa0c1d6fc8435c652ad
Content-Type: application/pdf; name="NAME"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="NAME"

< pdf encoded as base64 >

--b1_946c9f3e62087e2f21e9b761e448c41851da4fefa86a7aa0c1d6fc8435c652ad

R code to convert to pdf:

txt = readLines("test.txt")
a = base64enc::base64decode(txt)
writeBin(a, "test.pdf")

txt looks like this:

[1] "JVBERi0xLjMKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMSAwIFIKL1Jlc291cmNlcyAy"
[2] "IDAgUgovQ29udGVudHMgNCAwIFI+PgplbmRvYmoKNCAwIG9iago8PC9GaWx0ZXIgL0ZsYXRlRGVj"
[3] "b2RlIC9MZW5ndGggMjQzMT4+CnN0cmVhbQp4nM2bT3PbthbF9/kUWLbTBCbA/7u6cdu4k0nznj3t"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.