Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for files #47

Closed
jgaehring opened this issue Nov 1, 2021 · 4 comments · Fixed by #82
Closed

Add support for files #47

jgaehring opened this issue Nov 1, 2021 · 4 comments · Fixed by #82
Milestone

Comments

@jgaehring
Copy link
Member

I'm just noticing that the docs for the farmOS Data Model now include both data streams and files. At least, the navigation menu for Record Types now includes them, though they don't appear in the Introduction. Is that intentional, @mstenta?

This also seems like a good time for deciding if I want to parameterize all record types in the model, so if a consumer knows they'll never use data streams or files (eg, perhaps for certain SurveyStack applications), they can be omitted when instantiating the model. Of course, we could include some defaults if the entities are not provided, so essentially the parameter would be an override.

@jgaehring jgaehring added this to the 2.0.0-beta milestone Nov 1, 2021
@mstenta
Copy link
Member

mstenta commented Nov 1, 2021

At least, the navigation menu for Record Types now includes them, though they don't appear in the Introduction. Is that intentional, @mstenta?

Nope! Just forgot to add it to the intro. I'll do that...

@jgaehring
Copy link
Member Author

I think I'm going to restrict the scope of this issue to only files, since Field Kit does not use data streams in any way so far, but I am planning to overhaul images (farmOS/field-kit#45) prior to the FK beta release.

This also seems like a good time for deciding if I want to parameterize all record types in the model

I still really like this idea, and I feel I've gone a long ways to making this possible in the future with how I've encapsulated most of the details about specific entities in src/entities.js. But it's probably premature to do so now, when I don't have a concrete use case for it. That can be a separate issue when it arises.

@jgaehring jgaehring changed the title Add support for data streams and files Add support for files Nov 9, 2021
@jgaehring jgaehring mentioned this issue Nov 16, 2021
37 tasks
@jgaehring
Copy link
Member Author

I'm doing some preliminary investigation into how JSON:API file uploads will work in 2.x, and it looks promising, but will take some experimentation to figure out how best to fit this into farmOS.js itself. It may be instructive to hold off on this until I've resolved farmOS/field-kit#45, using the plain request method in farmOS.js instead of adding another independent method or including the process in the existing methods somehow. Otherwise it's a rather premature abstraction.

So I am moving this to the general release milestone, but will probably circle back to it first thing, once I resume on Field Kit.

@jgaehring jgaehring modified the milestones: 2.0.0-beta, 2.0.0 Nov 29, 2021
@jgaehring
Copy link
Member Author

@paul121 just pointed out a related issue, farmOS/farmOS.py#49, which should prove helpful, particularly this example of "Flow 1" as mentioned in the JSON:API change record:

# Flow 1: update existing log
data = open('data.csv', 'rb').read()
response = client.file.create('log', 'observation', 'file', data, 'observation_data.csv', '{log_id}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants