Hi Mona,<div><br></div><div>I worked through these API calls of yours, they seem reasonable and that they wouldn't change the item name.</div><div><br></div><div>One thing to consider, midas.item.create can be used to create an item, or modify an existing item. "name" is a required param whether you are creating or editing, but if you are editing, and you pass a different name than the original name, the name of the item will be changed. Is it possible that sometimes you are not passing up the (20) extension with the name and hence changing the name of the item when adding the metadata?</div>
<div><br></div><div>We've added the API calls for item.setmetadata and item.setmetadatamultiple, you could use those instead of item.create to set your metadata, assuming your server version has these API calls. This would at least eliminate the chance of accidentally renaming.</div>
<div><br></div><div>Thanks,</div><div>Mike</div><div><br></div><div><br><br><div class="gmail_quote">On Mon, Oct 22, 2012 at 5:44 PM, Mona Wong <span dir="ltr"><<a href="mailto:mona@sdsc.edu" target="_blank">mona@sdsc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div>Hi Patrick & Michael:<div><br></div><div><span style="white-space:pre-wrap"> </span>Ok, I have a bit more information about the duplicate filenames issue:</div>
<div><br></div><div><span style="white-space:pre-wrap"> </span>1. For the same code, it is inconsistent...sometimes it duplicate filenames and sometimes it appends the (#)...hard to debug, I know, sorry. Attached is an image that shows both duplicate filename and files with (#) appended:</div>
<div><br></div><div><img height="613" width="598" src="cid:476EFEAD-C895-41EE-9F25-55F7DD52EF25@sdsc.edu"></div><div><br></div><div><span style="white-space:pre-wrap"> </span>2. Here is the sequence of code steps:</div><div>
<br></div><div><span style="white-space:pre-wrap"> </span>a. <a href="https://ourserver.edu/api/json?method=midas.item.create&useSession&parentid=679&name=rkd2_merged_phase001.nii.axml&privacy=Private" target="_blank">https://ourserver.edu/api/json?method=midas.item.create&useSession&parentid=679&name=rkd2_merged_phase001.nii.axml&privacy=Private</a></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica;min-height:14px"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<font size="3"><span style="white-space:pre-wrap"> </span>b. <a href="https://ourserver.edu/api/json?method=midas.upload.generatetoken&useSession&itemid=62933&filename=rkd2_merged_phase001.nii.axml" target="_blank">https://ourserver.edu/api/json?method=midas.upload.generatetoken&useSession&itemid=62933&filename=rkd2_merged_phase001.nii.axml</a> (20)</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica;min-height:14px"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<font size="3"><span style="white-space:pre-wrap"> </span>c. <a href="https://ourserver.edu/api/json?method=midas.upload.perform&uploadtoken=13/62933/rkd2_merged_phase001.nii.axml" target="_blank">https://ourserver.edu/api/json?method=midas.upload.perform&uploadtoken=13/62933/rkd2_merged_phase001.nii.axml</a> (20)f4QDTF&filename=rkd2_merged_phase001.nii.axml (20)&length=838&folderid=null&itemid=62933</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica;min-height:14px"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<font size="3"><span style="white-space:pre-wrap"> </span>d. <a href="https://ourserver.edu/api/json?method=midas.item.create&useSession&name=rkd2_merged_phase001.nii.axml" target="_blank">https://ourserver.edu/api/json?method=midas.item.create&useSession&name=rkd2_merged_phase001.nii.axml</a> (20)&uuid=5085ba73ceaab2c352eb7122e0979f664998e7e152e1d&privacy=Private&_user name=Mona Wong&_timestamp=10/22/2012 14:28&_ontology term 1=mid myocardium</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<font size="3"><span style="white-space:pre-wrap"> </span>Of course, the above steps created the corrected filename (with (20) appended). Though it is the same steps that sometimes create files with duplicate name. If I can find a pattern that can reliably reproduce the duplicate filenames, I'll let you know.</font></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<font size="3">cheers,</font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica"><font size="3">Mona</font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica">
<br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 12px/normal Helvetica"><br></div><div><div><div class="im"><div>On Oct 22, 2012, at 7:24 AM, Michael Grauer wrote:</div>
<br></div><div class="im"><blockquote type="cite">Hi Mona,<div><br></div><div>Can you describe how you are getting to this and what the exact problem would be with how your users would interact with Midas when they encounter this situation?</div>
<div><br></div><div>I just tested with a Midas 3.2.8 instance. I could upload a file into a folder where an item "item1.txt" already existed with that name, using the Midas web UI uploader, and the new item was created as "item1.txt (1)". I also tried this with the latest version of Pydas (0.2.24), and again the item name had a numeric suffix, "item1.txt (2)". Once I had these items in the folder, I was able to change their names using the edit action on the Item so that all of the item names were the same.<br>
<br>Thanks,</div><div>Mike<br></div></blockquote></div></div><br><div class="im"><div>
<div style="word-wrap:break-word"><div><div><div>*********************************************</div><div> Mona Wong</div><div> Web & iPad Application Developer</div><div> San Diego Supercomputer Center</div>
<div><br></div><div> "Forgive everyone everything."</div><div><span style="white-space:pre-wrap"> </span>-- Regina Brett</div><div><div><div>*********************************************</div></div><div><br>
</div></div></div></div></div><br><br>
</div>
<br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks,<br>Michael Grauer<br>R & D Engineer<br>Kitware, Inc.<br>919 969 6990 x322<br><br><br><br>
</div>