Closed karuhanga closed 5 years ago
@paynejd I wonder if this might be the source of the issue.
Shouldn't this serializer field;
to_source_url = SourceURLField(view_name='source-detail', queryset=Concept.objects.all(), lookup_kwarg='source', lookup_field='source', required=False, source='to_source')
be;
to_source_url = SourceURLField(view_name='source-detail', queryset=Source.objects.all(), lookup_kwarg='source', lookup_field='source', required=False, source='to_source')
Notice the different querysets
.
@rkorytkowski Please prioritize this one also!
FYI I am not able to reproduce this error. Both of the following posts to create external mappings worked for me just now. Did the authorization token that you used have permission to post to that source?
POST https://api.demo.openconceptlab.org/user/sources/TestOrg/mappings/
{
"map_type": "SAME-AS",
"from_concept_url": "/orgs/OCL/sources/Classes/concepts/Test/",
"to_source_url": "/orgs/IHTSDO/sources/SNOMED-CT/",
"to_concept_code": "26958001",
"to_concept_name": ""
}
POST https://api.demo.openconceptlab.org/users/paynejd/sources/TestOrg/mappings/
{
"map_type": "SAME-AS",
"from_concept_url": "/orgs/OCL/sources/Classes/concepts/Test/",
"to_source_url": "/orgs/IHTSDO/sources/SNOMED-CT/",
"to_concept_code": "26958002",
"to_concept_name": ""
}
Just tried the same data;
POST https://api.demo.openconceptlab.org/users/admin/sources/Danns1/mappings/
and
POST https://api.demo.openconceptlab.org/user/sources/Danns1/mappings/
{
"map_type": "SAME-AS",
"from_concept_url": "/users/admin/sources/Danns1/concepts/b1h7a0g6a0b1f5d3vwrjkvs/",
"to_source_url": "/orgs/IHTSDO/sources/SNOMED-CT/",
"to_concept_code": "26958001",
"to_concept_name": ""
}
Tried using an incorrect token and I got;
@paynejd I'd also appreciate a mention so I can get notified when something addressed to me happens here.
@Karuhanga, I'm sorry, but I can't reproduce it... Your source is gone so I've created a new one, but the POST works, try: curl -X POST \ https://api.demo.openconceptlab.org/user/sources/dann/mappings/ \ -H 'authorization: Token b5e035fd219d610d075de85fb0fe0889273633e6' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -H 'postman-token: 68fafc96-d22b-d7af-6448-3573aea4363a' \ -d '{ "map_type": "SAME-AS", "from_concept_url": "/users/admin/sources/dann/concepts/dann/5d0c6f8dd5f376007da5befd/", "to_source_url": "/orgs/IHTSDO/sources/SNOMED-CT/", "to_concept_code": "2695808068", "to_concept_name": "" }' I've disabled resetting DB on the demo server for now so I can reproduce your error, if you are able to cause one.
Hey @rkorytkowski,
Just tried;
POST https://api.demo.openconceptlab.org/user/sources/I119/mappings/
Token b5e035fd219d610d075de85fb0fe0889273633e6
{
"map_type": "SAME-AS",
"from_concept_url": "/users/admin/sources/I119/concepts/Issue1191/",
"to_source_url": "/orgs/IHTSDO/sources/SNOMED-CT/",
"to_concept_code": "2695808068",
"to_concept_name": ""
}
Postman returns this after a ~10s wait;
Oddly, using curl returns something different;
@Karuhanga, I'm sorry I needed to redeploy demo and lost your data again. Maybe it's best you post how you've created source 'I119' and concept 'Issue1191'. Did you do it via API or WEB UI? What was the payload? It's best to see it in the CURL form.
Your CURL error is very strange. Maybe it's caused by some bad character, but it's hard to spot from an image. Please use plain text copy from terminal and paste here.
Hey @rkorytkowski,
curl -X POST https://api.demo.openconceptlab.org/user/sources/ -H 'authorization: Token 9b1faec66b0054ef94a726e46abd32fdf2216d12' -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{
"id": "TR2",
"preferred_source": "CIEL",
"public_access": "View",
"name": "Test Run 2",
"owner": "Individual",
"custom_validation_schema": "OpenMRS",
"description": "",
"default_locale": "en",
"supported_locales": "",
"repository_type": "OpenMRSDictionary",
"conceptUrl": ""
}'
curl -X POST https://api.demo.openconceptlab.org/users/admin/sources/TR2/concepts/ -H 'authorization: Token 9b1faec66b0054ef94a726e46abd32fdf2216d12' -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{
"id": "TR22",
"external_id": "63c25994-28af-45cd-93db-999eb0f5b0e6",
"concept_class": "Diagnosis",
"datatype": "Date",
"names": [
{
"id": "795ae968-e47d-41a8-98de-aa686bda862a",
"name": "TR2 2",
"locale": "en",
"locale_full": {
"value": "en",
"label": "English [en]"
},
"locale_preferred": true,
"name_type": "Fully Specified",
"uuid": "",
"external_id": "8dd9e703-8928-4ef2-af18-e5a9ad4fca68"
}
]
}'
curl -X POST https://api.demo.openconceptlab.org/users/admin/sources/TR2/mappings/ -H 'authorization: Token 9b1faec66b0054ef94a726e46abd32fdf2216d12' -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{
"map_type": "NARROWER-THAN",
"from_concept_url": "/users/admin/sources/TR2/concepts/TR22/",
"to_source_url": "/orgs/IHTSDO/sources/SNOMED-CT/",
"to_concept_code": "26958001",
"to_concept_name": null,
"external_id": "292d8158-1133-45f9-b348-3086343432de"
}'
@Karuhanga, thanks for your patience. I've finally reproduced the issue and fix is on the way. It should be deployed to qa in a few minutes. I'll test and push it to other envs by tomorrow morning.
Deployed to all envs.
Thanks @rkorytkowski. Just tested this and it is working as expected.
Quick one though. Referencing a to_concept_code that does not exist still creates the mapping. Is this the expected behavior on this? (The collection's validation schema is OpenMRS Validation)
Can you give us the example? The answer is sometimes yes, depending on whether its an internal or external mapping.
On Mon, Jul 1, 2019 at 2:52 PM Karuhanga Lincoln notifications@github.com wrote:
Quick one though. Referencing a to_concept_code that does not exist still creates the mapping. Is this expected behavior on this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OpenConceptLab/ocl_issues/issues/119?email_source=notifications&email_token=AAJCOOKK7QASQA2E7V23MFTP5JHANA5CNFSM4HSASM4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY7AW6Y#issuecomment-507382651, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJCOOKIOSKBXITQ4PW3XTLP5JHANANCNFSM4HSASM4A .
My understanding is that to_source & to_concept_code is always for an external mapping, thus points to concept, which do not exist in OCL, whereas to_concept_url is for an internal concept and it must exist in OCL.
@rkorytkowski that is correct. I am referring to external mappings only @paynejd. So there is no way to verify validity of an external concept in this case?
That's correct @Karuhanga -- since external mappings are "external" to OCL, OCL does not currently have the ability to verify codes. It would be possible in the future to validate the syntax/format of a code or to even validate with an external API service if available, but we do not do that now.
Thanks @paynejd.
Tested mapping:
POST https://api.demo.openconceptlab.org/users/admin/sources/585T/mappings/