Creating Visits/Encounters via FHIR: A tale of flags

We’re having some problems on how to represent OpenMRS visits and Encounters using FHIR Encounter resources. When exporting OpenMRS visits and Encounters, we represent both as FHIR Encounters. However, Visits make use of the FHIR “part of” attribute to indicate that it contains multiple OpenMRS encounters. Using this, users can differentiate between encounters/visits.

But the same doesn’t apply when we try to create OpenMRS visits/encounters using a FHIR encounter. How does the FHIR API know that the FHIR encounter it just received is a OpenMRS Visit, and not an OpenMRS Encounter? we clearly need some way to define this. One suggestion is of course to represent this using a custom extension, and honestly, that seems to be the only option available to us right now.