fhir-parser icon indicating copy to clipboard operation
fhir-parser copied to clipboard

Unable to run generate.py without error

Open dadocsis opened this issue 4 years ago • 0 comments

Similar to #33

"Out of the box"

  1. clone and cd into fresh repo, pip install -r requirements
  2. copy ./Defaults/settings.py & mappings.py to ../
  3. cd into ./Samples
  4. run ./generate.py

Got.. Exception: Unable to create a member name for enum '!=' in http://hl7.org/fhir/questionnaire-enable-operator. You may need to add '!=' to mappings.enum_map

So I went ahead and added '!=': 'ne" to mappings.enum (actually had to change both ./Default/mappings.py and ../mappings.py

Now I run generate and it appears to create all the models but fails during unit test creation: Traceback (most recent call last): File "./generate.py", line 31, in spec.write() File "/root/fhir-parser/fhirspec.py", line 277, in write self.parse_unit_tests() File "/root/fhir-parser/fhirspec.py", line 245, in parse_unit_tests controller.find_and_parse_tests(self.directory) File "/root/fhir-parser/fhirunittest.py", line 31, in find_and_parse_tests test = self.unittest_for_resource(resource) File "/root/fhir-parser/fhirunittest.py", line 63, in unittest_for_resource return FHIRUnitTest(self, resource.filepath, resource.content, klass) File "/root/fhir-parser/fhirunittest.py", line 102, in init self.expand() File "/root/fhir-parser/fhirunittest.py", line 137, in expand tests.extend(item.create_tests(self.controller)) File "/root/fhir-parser/fhirunittest.py", line 174, in create_tests test = FHIRUnitTest(controller, self.filepath, self.value, self.klass, prefix) File "/root/fhir-parser/fhirunittest.py", line 102, in init self.expand() File "/root/fhir-parser/fhirunittest.py", line 136, in expand item = FHIRUnitTestItem(self.filepath, path, val, propclass, False, prop.enum) File "/root/fhir-parser/fhirunittest.py", line 157, in init self.enum = enum_item['name'] if enum_item is not None else None TypeError: 'FHIRValueSetEnum' object is not subscriptable

Any ideas what I am doing wrong? My guess is it has something to with me adding '!=': 'ne'

dadocsis avatar Apr 15 '20 20:04 dadocsis