digitalfabrik / entitlementcard

App for 'Digitale Berechtigungskarten', generally benefit card for volunteers or socially vulnerable groups in Germany. App for Android & iOS + Backend + Administration Web Portal – 100% Open Source.
MIT License
36 stars 3 forks source link

Map stores to regions #538

Open steffenkleinle opened 2 years ago

steffenkleinle commented 2 years ago

Is your feature request related to a problem? Please describe. With #537 each store (PhysicalStore) in the database has a foreign key reference to the region it belongs to. For now, all stores reference a mock region though and not the actual region that issued the store. The regions are also hardcoded in region/database/Setup.kt instead of dynamically extracting them from the correct dynamic source (probably app-daten.xml?).

Describe the solution you'd like

Describe alternatives you've considered None

Additional context The app-daten.xml currently does not include a five digit kreisschlüssel. Not sure how to proceed here. There are some TODOs in the code referencing this issue, just search for #538.

steffenkleinle commented 2 years ago

@maxammann do you have any more input here? Is the description correct? Where do we get the regions from/how do we map stores to regions?

maxammann commented 2 years ago
steffenkleinle commented 2 years ago
  • I updated the first bullet point. There is probably no external data source additionally to the app-daten.xml. There is only the app-daten.xml

    • I added the second bullet point.

However there is no kreisschlüssel in the app daten xml, how can we map that to regions? Without a kreisschlüssel we need to change the database scheme again since it has to be nullable then. Also in theory it may happen that a landkreis or stadt does not publish stores but has card holders. Since cards only belong to a region, this may lead to problems as the region may not exist anymore.

maxammann commented 2 years ago
  • I updated the first bullet point. There is probably no external data source additionally to the app-daten.xml. There is only the app-daten.xml

    • I added the second bullet point.

However there is no kreisschlüssel in the app daten xml, how can we map that to regions? Without a kreisschlüssel we need to change the database scheme again since it has to be nullable then. Also in theory it may happen that a landkreis or stadt does not publish stores but has card holders. Since cards only belong to a region, this may lead to problems as the region may not exist anymore.

True, so the kreischlüssel should be optional. It should also be possible that Users overwrite the imported kreischlüssel if its imported (future work).

So regions should not be deleted. As long as there are stores or cards in a region it will exist.

f1sh1918 commented 1 year ago

The regions have to be mapped to the stores via normale agency ID. Check freinet documentation for further information