Hi Jae, thanks for posting your code. With a little bit of modification I
was able to use it on my current project, and it ran correctly. For the
big picture, this will be a very helpful utility for v3 arches, but in v4
Farallon plans to deprecate the .arches format
<https://github.com/archesproject/arches/wiki/Import-Export>, so this
conversion won't be necessary. But in the meantime I'm sure it can be
helpful to me and others.
I did a little bit of testing, and this is what I understand your issue to
be: When arches runs the export function, it uses the concept UUID to
define relationship types in the generated .relations file. However, these
UUIDs can't easily be converted into the conceptid that you have listed in
your authority files because that UUID is created and stored in the
postgres db only when the package is installed. So, you can't translate
those UUIDs into conceptids like you can with all of the other concepts
that are written in the json.
I don't think you can solve this in your own script, because the UUIDs are
completely independent of your authority files. Maybe the best thing to do
would be to modify the arches export function so that it writes the concept
label ("is related to", for example) instead of the UUID to the output
.relations file. As it is, I tried using load_resources with a .relations
file that had a UUID from the exported version, and it was unable to read
that UUID. So don't know how that exported .relations file can be used at
all.
It may be nice to begin aggregating some of these utility scripts that are
meant to run from within the source_data directory of a v3 package. I have
a couple already here
<https://github.com/mradamcox/afrh/tree/master/afrh/source_data> that have
some similar functions, and could ultimately be combined at some point...
On Tuesday, March 29, 2016 at 9:41:54 AM UTC-6, Jae Hun Lee wrote:
>
> Hello,
>
> I've created a small python script that convert JSON to .ARCHES. I hope I
> can get help from this community for testing it.
> The link to the script:
> https://github.com/oixhwotl/archesproject3/raw/master/exported/arches_json_to_arches.py
>
> The Arches command for exporting data is shown as below:
> $ python manage.py packages -o export_resources -d <new_out_file_path>
> (e.g) ...:~/my_hip_app2$ python packages -o export_resource -d
> exported/backup_201603292124
>
> The script needs two arguments, and creates a sample.arches file under
> <path_to_source_data>/business_data/
> $ python arches_json_to_arches.py <new_out_file_path> <path_to_source_data>
> (e.g) ...:~/my_hip_app2$ python exported/arches_json_to_arches.py
> exported/backup_201603292124 my_hip_app/source_data
>
> If BUSISNESS_DATA_FILES is set in settings.py, you can reinitialize Arches
> with following command:
> python manage.py packages -o install
>
> or you can just add the new .arches with following command:
> $ python manage.py packages -o import_resources -s
> <path_to_source_data>/business_data/sample.arches
> (e.g) ...:~/my_hip_app2$ python manage.py packages -o import_resources
> my_hip_app/source_data/business_data/sample.arches
>
> It has one problem. It can't recover RELATION_TYPE field in .relations
> file.
>
> Can anybody help me by testing it? I must warn you that you should have
> your data backed up some place safe. If this script works without any
> problem, then I don't have to explain how to create .arches files to my
> project stakeholders. Thank you in advance.
>
--
-- To post, send email to [email protected]. To unsubscribe, send
email to [email protected]. For more information,
visit https://groups.google.com/d/forum/archesproject?hl=en
---
You received this message because you are subscribed to the Google Groups
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.