fair-research / minid-server

5 stars 3 forks source link

can mint two ids for same object #12

Open bheavner opened 6 years ago

bheavner commented 6 years ago

If I mint a minid two times in a row (same checksum, etc.), the server mints new minids both times - shouldn't the server refuse to make a new minid if the entity already exists?

httr::with_verbose(httr::POST(url, body = body, ua, encode = "json"))
-> POST /minid HTTP/1.1
-> Host: minid.bd2k.org
-> User-Agent: https://github.com/bheavner/minidtools
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, */*
-> Content-Type: application/json
-> Content-Length: 368
-> 
>> {"test":"False","checksum_function":"sha256","checksum":"2958cdfafa3001be6db6f059f263cf98d359668611c6e425b9a79dc68a6ede69","email":"bheavner@gmail.com","code":"argleflarg","title":"2_snv.tsv.gz","locations":["sftp://gap-upload.ncbi.nlm.nih.gov/exchange/Combined_Study_Data/Genotypes/freeze.5_annotation/WGSA_parsed/provisional/2_snv.tsv.gz"]}

<- HTTP/1.1 201 CREATED
<- Date: Thu, 14 Jun 2018 22:40:33 GMT
<- Server: Apache/2.4.7 (Ubuntu)
<- Content-Length: 43
<- Content-Type: application/json
<- 
Response [http://minid.bd2k.org/minid]
  Date: 2018-06-14 22:40
  Status: 201
  Content-Type: application/json
  Size: 43 B
{
  "identifier": "ark:/99999/fk4pg2wz61"

Here's my second minted minid for the same json:

httr::with_verbose(httr::POST(url, body = body, ua, encode = "json"))
-> POST /minid HTTP/1.1
-> Host: minid.bd2k.org
-> User-Agent: https://github.com/bheavner/minidtools
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, */*
-> Content-Type: application/json
-> Content-Length: 368
-> 
>> {"test":"False","checksum_function":"sha256","checksum":"2958cdfafa3001be6db6f059f263cf98d359668611c6e425b9a79dc68a6ede69","email":"bheavner@gmail.com","code":"argleflarg","title":"2_snv.tsv.gz","locations":["sftp://gap-upload.ncbi.nlm.nih.gov/exchange/Combined_Study_Data/Genotypes/freeze.5_annotation/WGSA_parsed/provisional/2_snv.tsv.gz"]}

<- HTTP/1.1 201 CREATED
<- Date: Thu, 14 Jun 2018 22:44:31 GMT
<- Server: Apache/2.4.7 (Ubuntu)
<- Content-Length: 43
<- Content-Type: application/json
<- 
Response [http://minid.bd2k.org/minid]
  Date: 2018-06-14 22:44
  Status: 201
  Content-Type: application/json
  Size: 43 B
{
  "identifier": "ark:/99999/fk4jq2655q"
mikedarcy commented 6 years ago

I thought the intention was to allow different users (identities) to create minids for the same object. It does seem redundant to allow the same user/identity to create a new minid for an object that they have already created one for. They should be updating that existing identifier rather than peeling off a new one. Maybe this is just a bit of missing logic on the backend?

bheavner commented 6 years ago

I thought there was a check somewhere to see if the checksum already existed. It'd make sense to me to have a 1:1 mapping of checksums to minids, but a minid can have many locations... location-parsing is up to clients for now, I think.