-1

I have a program that pulls data from a railway live feed and this feed has Location codes.

the codes are generally 6 Digit numbers EG 890001 = STATION_NAME.

there are over 500 Locations for reporting of train locations and I will need to pop these into a data base of reference file. on occasions the locations codes may change as new infrastructure is added so if possible i would need it to be fairly user friendly as well (however I could just add in a GUI for changing this in my main program if required).

Ideally the reference file or database would Look like this

LOCATION CODE           LOCATION NAME
666666                  Location_Name   

so what would be the best way to store this!?

Fildor
  • 14,510
  • 4
  • 35
  • 67
Chris_livermore
  • 171
  • 1
  • 13
  • How do you define "best"? What are your requirements? Shall it be human readable so it can be edited outside the application? If so, do you want the app to watch the file for outside changes? Would you prefer a centralized "public" DB somewhere on a cloud? – Fildor Aug 25 '17 at 12:03
  • VTC as Opinion Based. I'm thinking you are still learning about how databases work. I would use this as an opportunity to learn more about whichever database management system may have attracted your interest. Consider learning about [SQL Server](https://www.microsoft.com/en-US/sql-server/sql-server-2017) or [MySQL](https://www.mysql.com/). – Bob Kaufman Aug 25 '17 at 12:04
  • What Bob said + KeyValueStores, CSV Files, XML, JSon, ... SQLite ... – Fildor Aug 25 '17 at 12:05
  • See this: https://stackoverflow.com/a/35437460/982149 – Fildor Aug 25 '17 at 12:12
  • "on occasions the locations codes may change as new infrastructure is added" - How would *you* be notified of this? Is there some online-resource for these key-value-mappings? – Fildor Aug 25 '17 at 12:15
  • You tagged the question with XML so I guess you are trying to determine if it is better to use a database vs xml. You should always use a database when "multiple uses" are reading/writing data. XML is good when one user is writing data and one or more users are only reading the file after all data is written. Also it is best to limit xml file size so it is not huge. – jdweng Aug 25 '17 at 12:32

1 Answers1

0

What do you mean by "best"? Fastest? Easiest? "Scalablest"?

Without any context, I would say do what you know how to do. It sounds like you need something that can join location-name by a location code - so maybe just some SQL? If you need something more file-based, maybe take a look at https://www.sqlite.org

Julian
  • 1,050
  • 1
  • 12
  • 23
  • well easiest would be best as local IT department are not the most Tech savey! – Chris_livermore Aug 25 '17 at 12:05
  • "local IT department are not the most Tech savey" - LOL ... In that case go for a CSV file and [watch it](https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx) for changes. – Fildor Aug 25 '17 at 12:06
  • with sqlite, the database-process is embedded in you program, nothing for the IT department to handle (besides backing up the file). – Julian Aug 25 '17 at 12:08
  • 1
    @Chris_livermore it's not the IT department's job to handle *your application's* caching and lookup mechanism. That's yours. *You* have to decide what the requirements and constraints are, and how to cache the data so they *don't* have to handle anything. Tech savvy IT departments terminate contracts that force them to do such things – Panagiotis Kanavos Aug 25 '17 at 12:13
  • thank you! I will start with CSV and definitely look into SQL and JSON for future projects – Chris_livermore Aug 25 '17 at 12:21