Welcome to Fused! If you are reading this guide you are about to start creating your first UDF and start contributing to the Community UDFs. This guide highlights all the best practices to create an impactful UDF. Lets Dive in information.
- Example UDFs for Reference
- Join the Community
- Create the UDF
- The UDF Style Guide
- Data Sources
- Get Feedback and Ask for Help
- Configure the Settings
- Pre-commit
- Submit a Pull Request
These are some of our most loved UDFs created by the community:
# | UDF | Description of the UDF | Tags | Author |
---|---|---|---|---|
1 | H3 Hexagon Layer Example |
|
H3, Hexagon, NYC. | Isaac Brodsky |
2 | Flood Risk Analysis |
|
Flood, Environment, Urban Planning | K_Njoroge |
3 | Data Center Location Model |
|
h3, data-center, pozibl, highspy optimization | Fabion Kauker |
4 | Ibis H3 Example |
|
h3, duck-db, ibis | Isaac Brodsky |
Explore more UDFs for your usecases or develop one using your own data source in the workbench.
- Discord - Our Discord community is excellent and we encourage you to share your progress on the General channel. We would love to hear what you are planning to build and help you throughout your journey.
- ask-for-help - Post your doubts and stoppers on the as-got-help section of the Discord and we will do our best to solve your problems regarding building of the UDF
- Documentation - Please go through our extensive documentation of all the functions on the documentation.
Each UDF is expected to follow certain style and patterns
-
Imports:
- Always put imports at the top of the file, just after any module comments and docstrings, and before module globals and constants.
- Avoid wildcard imports (
from <module> import *
). - Use 4 spaces per indentation level.
-
Comments:
- Use comments to explain the code, especially complex logic. Refer to the PEP 8 guidelines on comments.
-
Type Hinting:
- Type hinting is encouraged to make the code more readable and maintainable. Refer to the Python documentation on type hinting for more details.
Example:
def udf(param1: int, param2: str) -> str:
Ensure that all the external data sources being used are either from pubclicly available sources or uploaded to the disk from the Fused Upload File section.
Keep Sharing your progress on our Discord general channel and get feedback from us and other community members.
Post your doubts and stoppers on the ask-for-help section of the Discord and we will do our best to solve your problems regarding building of the UDF
Configure the settings in the workbench to increase your visibility and making it more convenient for others to reuse the UDF that you create.
- Setting Default Parameters - For UDFs that feature modifiable parameters to alter outputs, it's crucial to list all possible options under the "Default Parameter Values" section. This will ensure that these parameters are easily accessible via a dropdown menu in the UDF interface within the Layers section. Providing a comprehensive list of default parameters enhances usability and encourages experimentation.
- Default View State -Establish a Default View State for your UDF to set a predetermined viewport on the map. This feature ensures that users who load your UDF will start with a consistent view, offering a standardized initial experience. This setting is especially helpful for orienting new users to the UDF's intended geographic focus or area of interest.
- Add Tags - Tags play a vital role in increasing the discoverability of your UDF. When adding your UDF to the repository, include relevant tags that describe its functionality, application domain, and any other pertinent attributes. Well-chosen tags can significantly enhance the visibility of your UDF within the community, making it easier for users to find and utilize your work.
- Description - Describe your UDF! Elaborate on what your UDF accomplishes and mention your data sources and any relevant links. You can also mention the steps to run the UDF in jupyter notebook.This section supports Markdown links, code blocks, and headers are supported, which allows for organized presentation of your content.
Please run pre-commit hooks on your UDF prior to submitting.
pre-commit install
pre-commit run --files /*Your UDF Folder*/*
- Create a Branch : To start, create a new branch specifically for your UDF. This helps isolate your changes and makes the review process more manageable. Use a descriptive name for your branch that reflects the nature of the UDF.
- Commit Your Changes : Once your UDF is ready and tested, commit your changes. Be sure to write a clear and descriptive commit message that explains what you've developed or changed.
- Open a Pull Request : Push your changes and open a Pull Request and let us get back to you for any reviews if needed.
- View your latest UDF in the workbench Catalog! : Once the Pull request is accepted and it is merged, you and everyone else will be able to view and import your unique UDF from within the workbench.
Congratulations! You are an author of a UDF now which can be used and accessed by users around the globe 🌎