Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smart.prepare() results in FHIRValidationError for public R4 servers #79

Closed
navndn opened this issue Sep 25, 2019 · 1 comment
Closed

Comments

@navndn
Copy link

navndn commented Sep 25, 2019

Hello everyone,

I'm testing out fhirclient 4.0.0 (Python 3.7) with hapi R4 server

settings = {
    'app_id': 'fhir',
#     'api_base': 'http://test.fhir.org/r4'
    'api_base': 'http://hapi.fhir.org/baseR4'
}
smart = client.FHIRClient(settings=settings)    

# capabilitystatement.CapabilityStatement.read_from('metadata', smart.server)
smart.prepare()

And I get this validation error

FHIRValidationError: {root}:
  rest.0:
    resource.70:
      searchParam.14:
        'Non-optional property "type" on <models.capabilitystatement.CapabilityStatementRestResourceSearchParam object at 0x7fe54cef1668> is missing'

Link to capability statement http://hapi.fhir.org/baseR4/metadata

Does anyone else facing this?

Below is the full trace of the error ..

---------------------------------------------------------------------------
FHIRValidationError                       Traceback (most recent call last)
<ipython-input-44-687512ba52eb> in <module>
      7 
      8 # capabilitystatement.CapabilityStatement.read_from('metadata', sof.server)
----> 9 sof.prepare()

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/client.py in prepare(self)
    115             if self.server.ready:
    116                 return True
--> 117             return self.server.prepare()
    118         return False
    119 

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/server.py in prepare(self)
    148         """
    149         if self.auth is None:
--> 150             self.get_capability()
    151         return self.auth.ready if self.auth is not None else False
    152 

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/server.py in get_capability(self, force)
     82             logger.info('Fetching CapabilityStatement from {0}'.format(self.base_uri))
     83             from models import capabilitystatement
---> 84             conf = capabilitystatement.CapabilityStatement.read_from('metadata', self)
     85             self._capability = conf
     86 

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/fhirabstractresource.py in read_from(cls, path, server)
    108 
    109         ret = server.request_json(path)
--> 110         instance = cls(jsondict=ret)
    111         instance.origin_server = server
    112         return instance

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/capabilitystatement.py in __init__(self, jsondict, strict)
    132         Type `str`. """
    133 
--> 134         super(CapabilityStatement, self).__init__(jsondict=jsondict, strict=strict)
    135 
    136     def elementProperties(self):

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/domainresource.py in __init__(self, jsondict, strict)
     40         Type `Narrative` (represented as `dict` in JSON). """
     41 
---> 42         super(DomainResource, self).__init__(jsondict=jsondict, strict=strict)
     43 
     44     def elementProperties(self):

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/resource.py in __init__(self, jsondict, strict)
     40         Type `Meta` (represented as `dict` in JSON). """
     41 
---> 42         super(Resource, self).__init__(jsondict=jsondict, strict=strict)
     43 
     44     def elementProperties(self):

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/fhirabstractresource.py in __init__(self, jsondict, strict)
     23                 .format(self.__class__, jsondict['resourceType']))
     24 
---> 25         super(FHIRAbstractResource, self).__init__(jsondict=jsondict, strict=strict)
     26 
     27     @classmethod

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/fhirabstractbase.py in __init__(self, jsondict, strict)
     64         if jsondict is not None:
     65             if strict:
---> 66                 self.update_with_json(jsondict)
     67             else:
     68                 try:

~/.virtualenvs/fhir/lib/python3.7/site-packages/fhirclient/models/fhirabstractbase.py in update_with_json(self, jsondict)
    229 
    230         if len(errs) > 0:
--> 231             raise FHIRValidationError(errs)
    232 
    233     def as_json(self):

FHIRValidationError: {root}:
  rest.0:
    resource.70:
      searchParam.14:
        'Non-optional property "type" on <models.capabilitystatement.CapabilityStatementRestResourceSearchParam object at 0x7fe54cef1668> is missing'
@navndn
Copy link
Author

navndn commented Sep 25, 2019

@p2 p2 closed this as completed Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants