opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
53 stars 41 forks source link

Refactor FHIRCarePlanGenerator Class #3386

Open f-odhiambo opened 1 month ago

f-odhiambo commented 1 month ago

This is a follow-up for https://github.com/opensrp/fhircore/pull/3385 to be worked on in the next CHT

Sample code

listOf(CanonicalType("PlanDefinition/$canonicalValue"))
f-odhiambo commented 1 month ago

Here is one

 // TODO refactor this code to remove hardcoded appended "PlanDefinition/" on https://github.com/opensrp/fhircore/issues/3386
  private fun CarePlan.cleanPlanDefinitionCanonical() {
    val canonicalValue = this.instantiatesCanonical.first().value
    if (canonicalValue.contains('/').not()) {
      this.instantiatesCanonical = listOf(CanonicalType("PlanDefinition/$canonicalValue"))
    }
  }