APIs - SmallFundamentals/sana.mds GitHub Wiki

src/mds/api/v1/api.py: The new APIs are similar to the existing ones.

  • get_binary_checksum

    • Returns two checksums (rolling and md5) of the BinaryResource object associated with an encounter (saved procedure). If binary data is empty, it fills data with zero.
    • arguments: procedure_guid, element_id, file_size
    • return: a tuple of two checksums (list)
  • register_rolling_binary_chunk

    • Writes chunked binary data to the BinaryResource object associated with an encounter (saved procedure). It overwrites zero-filled section at the given index with given binary data.
    • arguments: sp_guid, element_id, element_type, binary_guid, file_size, index, byte_data
    • return: a tuple of result (bool) and message (string)
    • NOTE: byte_data is a single block, not the list of chunks

src/mds/api/v1/json.py: This file contains the endpoints that Java client accesses. The endpoints use APIs in api.py.

  • checksums_get

    • url: json/checksums/get/
    • arguments: request object, which should contain ChecksumRequestForm
    • return: a tuple of two checksums (list) in JSON
  • rolling_binarychunk_submit

    • url: json/rolling_binarychunk/submit/
    • arguments: request object, which should contain RollingBinaryPacketForm
    • return: success or fail message