Skip to content

Commit

Permalink
Merge pull request #12 from fhir-crucible/backbone-base-validation
Browse files Browse the repository at this point in the history
Follow basebone elements for base resource validation.
  • Loading branch information
radamson authored Feb 11, 2019
2 parents 62cfbfd + 0aeba93 commit a79c543
Show file tree
Hide file tree
Showing 25 changed files with 45 additions and 46 deletions.
4 changes: 2 additions & 2 deletions lib/fhir_dstu2_models/bootstrap/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def validate_field(field, value, contained_here, meta, errors)
else
errors[field] << "#{meta['path']}: expected Reference, found #{klassname}"
end
# if the data type is a particular resource or complex type
elsif FHIR::DSTU2::RESOURCES.include?(datatype) || FHIR::DSTU2::TYPES.include?(datatype)
# if the data type is a particular resource or complex type or BackBone element within this resource
elsif FHIR::DSTU2::RESOURCES.include?(datatype) || FHIR::DSTU2::TYPES.include?(datatype) || v.class.name.start_with?(self.class.name)
if datatype == klassname
validation = v.validate(contained_here)
errors[field] << validation unless validation.empty?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
"coding": [
{
"code": "attending"
"code": "ATND"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{
"coding": [
{
"code": "attending"
"code": "ATND"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand All @@ -79,7 +79,7 @@
{
"sequence": 2,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down Expand Up @@ -113,7 +113,7 @@
{
"sequence": 3,
"type": {
"code": "group"
"code": "CPNDDRGING"
},
"provider": {
"reference": "Practitioner/example"
Expand Down Expand Up @@ -141,7 +141,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"service": {
"system": "http://hl7.org/fhir/oralservicecodes",
Expand All @@ -161,7 +161,7 @@
{
"sequence": 2,
"type": {
"code": "service"
"code": "CSINV"
},
"service": {
"system": "http://hl7.org/fhir/oralservicecodes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "#practitioner-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
{
"sequence": 2,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down Expand Up @@ -247,7 +247,7 @@
{
"sequence": 3,
"type": {
"code": "group"
"code": "CPNDDRGING"
},
"provider": {
"reference": "Practitioner/example"
Expand Down Expand Up @@ -275,7 +275,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"service": {
"system": "http://hl7.org/fhir/oralservicecodes",
Expand All @@ -295,7 +295,7 @@
{
"sequence": 2,
"type": {
"code": "service"
"code": "CSINV"
},
"service": {
"system": "http://hl7.org/fhir/oralservicecodes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{
"sequence": 1,
"type": {
"code": "group"
"code": "CPNDDRGING"
},
"provider": {
"reference": "Practitioner/example"
Expand All @@ -82,7 +82,7 @@
{
"sequence": 1,
"type": {
"code": "product"
"code": "CPINV"
},
"service": {
"system": "http://hl7.org/fhir/ex-visionservice",
Expand All @@ -102,7 +102,7 @@
{
"sequence": 2,
"type": {
"code": "product"
"code": "CPINV"
},
"service": {
"system": "http://hl7.org/fhir/ex-visionservice",
Expand All @@ -125,7 +125,7 @@
{
"sequence": 3,
"type": {
"code": "tax"
"code": "VRXINV"
},
"service": {
"system": "http://hl7.org/fhir/ex-visionservice",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_dstu2_models/examples/json/claim-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
"sequence": 1,
"type": {
"code": "service"
"code": "CSINV"
},
"provider": {
"reference": "Practitioner/example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<participant>
<type>
<coding>
<code value="attending"/>
<code value="ATND"/>
</coding>
</type>
<actor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<participant>
<type>
<coding>
<code value="attending"/>
<code value="ATND"/>
</coding>
</type>
<required value="required"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand All @@ -85,7 +85,7 @@
<item>
<sequence value="2"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down Expand Up @@ -118,7 +118,7 @@
<item>
<sequence value="3"/>
<type>
<code value="group"/>
<code value="DRUGING"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand All @@ -145,7 +145,7 @@
<detail>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/oralservicecodes"/>
Expand All @@ -165,7 +165,7 @@
<detail>
<sequence value="2"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/oralservicecodes"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="#practitioner-1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<item>
<sequence value="2"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down Expand Up @@ -222,7 +222,7 @@
<item>
<sequence value="3"/>
<type>
<code value="group"/>
<code value="DRUGING"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand All @@ -249,7 +249,7 @@
<detail>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/oralservicecodes"/>
Expand All @@ -269,7 +269,7 @@
<detail>
<sequence value="2"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/oralservicecodes"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<item>
<sequence value="1"/>
<type>
<code value="service"/>
<code value="CSINV"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<item>
<sequence value="1"/>
<type>
<code value="group"/>
<code value="DRUGING"/>
</type>
<provider>
<reference value="Practitioner/example"/>
Expand All @@ -87,7 +87,7 @@
<detail>
<sequence value="1"/>
<type>
<code value="product"/>
<code value="CPINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/ex-visionservice"/>
Expand All @@ -107,7 +107,7 @@
<detail>
<sequence value="2"/>
<type>
<code value="product"/>
<code value="CPINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/ex-visionservice"/>
Expand All @@ -130,7 +130,7 @@
<detail>
<sequence value="3"/>
<type>
<code value="tax"/>
<code value="CPINV"/>
</type>
<service>
<system value="http://hl7.org/fhir/ex-visionservice"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
</binding>
<mapping>
<identity value="c-cda"/>
<language value="xpath"/>
<map value="/ClinicalDocument/recordTarget/patientRole/patient/administrativeGender"/>
</mapping>
</element>
Expand Down
Loading

0 comments on commit a79c543

Please sign in to comment.